Skip to content

Commit

Permalink
Fix error reporting at program exit. (#415)
Browse files Browse the repository at this point in the history
  • Loading branch information
balhoff authored May 10, 2022
1 parent 5fe6252 commit e4655b1
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions src/main/scala/org/monarchinitiative/dosdp/cli/Main.scala
Original file line number Diff line number Diff line change
Expand Up @@ -40,10 +40,13 @@ object Main extends ZCommandApp[Config] {
) >>> initializeSlf4jBridge
val program = ZIO.effectTotal(JenaSystem.init()) *> config.run
program
.tapError { e =>
if (config.common.verbose) ZIO.succeed(e.printStackTrace())
else log.error(e.getMessage)
}
.as(ExitCode.success)
.catchAll { case DOSDPError(_, e) =>
if (config.common.verbose) ZIO.effectTotal(e.printStackTrace()).as(ExitCode.failure)
else ZIO.unit.as(ExitCode.failure)
ZIO.unit.as(ExitCode.failure)
}
.provideCustomLayer(env)
}
Expand Down

0 comments on commit e4655b1

Please sign in to comment.