GMOD / Apollo3

JBrowse 2 plugin for editing annotations on an Apollo server
Apache License 2.0
6 stars 4 forks source link

CLI logging and error handling improvements #398

Open garrettjstevens opened 4 weeks ago

garrettjstevens commented 4 weeks ago

I was running into some problems with the CLI silently failing, so here are some things I found that we need to do to make the CLI error output better:

As an example of a couple points above, something like

this.logToStderr(
  'Error: End coordinate is lower than the start coordinate',
)
this.exit(1)

should become

this.error('End coordinate is lower than start coordinate')

And something like this:

try {
  config = YAML.parse(data)
} catch (error) {
  this.logToSterr('Problem parsing config file')
  this.exit(1)
}

should become

try {
  config = YAML.parse(data)
} catch (error) {
  this.error(error, { suggestions: ['Make sure the config file is a valid YAML document']} )
}