#Making sure `Result`s are not ignored

1 messages · Page 1 of 1 (latest)

sage shale
#

is there any way I can make sure I'm not ignoring errors? as of now I can do

this_can_fail()
io.println("success")

and I'll never know if it failed despair

fresh halo
#

The compiler will emit a warning for this

sage shale
#

is there any flag I need to set? because in my case it doesn't

dire ermine
#

Can you try gleam clean

#

And then rebuild

sage shale
#

same thing

#

let me try and reproduce it outside my project

fresh halo
#

What does that function return?

sage shale
#

snag.Result(String)

dire ermine
#

More snag users ✨

#

that lib needs some love

fresh halo
#

How strange

#

I wonder what is happening

#

It’s supposed to emit a warning

sage shale
#
import snag
import gleam/io

pub fn main() {
  case "doesn't matter" {
    _ -> {
      snag.error("oh god please make it stop!!!!!")
    }
  }
  io.println("weird noises? it's all good man, don't worry about it :)")
}
#
gleam run
  Compiling ignore_result
   Compiled in 0.23s
    Running ignore_result.main
weird noises? it's all good man, don't worry about it :)
#

with Error in place of snag.error it emits a warning

fresh halo
#

Could you open an issue please

sage shale
#

lucydebugfail will do

fresh halo
#

Thank you

fresh halo
#

Bug fixed on main!

dire ermine
sage shale