In some custom tasks, I detect some error, and I'm using this way to signal an error and stop processing current task:
sys.error("Some error")
Internally it throws a RunTimeException.
SBT shows a stack trace, and I'd like to report an error without stack trace. For expected errors, it is often verbose, not meaningful and confuses end users.
The stack trace is shown when running from the command line, not the shell, where the stack trace only is shown with the last
command.
Is there a standard way of reporting errors with no stack trace?
UPDATE:
Asked to the SBT team for a better solution.
Not yet. But there's an undocumented, not-guaranteed-to-work-in-the-future way.Edit: As Dale commented
sbt.internal.util.MessageOnlyException
is aliased tosbt.MessageOnlyException
, so we can use the following:This is not guaranteed to work in the future because it's using
sbt.internal
, but basicallyMessageOnlyException
does what you are asking I think.