Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

RunAsCLI() swallows exceptions #619

Closed
pkit opened this issue Aug 21, 2023 · 4 comments · Fixed by #633
Closed

RunAsCLI() swallows exceptions #619

pkit opened this issue Aug 21, 2023 · 4 comments · Fixed by #633
Labels

Comments

@pkit
Copy link

pkit commented Aug 21, 2023

It looks like you use execute() from the ts-command-whatever library.
Which silently swallows all exceptions by default.
Should be documented probably?

@mmkal
Copy link
Contributor

mmkal commented Nov 4, 2023

ts-command-whatever (excellent name) has a method called executeWithoutErrorHandling. I'll look into mapping a CLI arg to it.

@mmkal
Copy link
Contributor

mmkal commented Nov 4, 2023

You can change this behaviour by subclassing:

import {Umzug, UmzugCLI, CommandLineParserOptions} from 'umzug'

class MyUmzugCLI extends UmzugCLI {
  async execute() {
    await super.executeWithoutErrorHandling()
    return true
  }
}

class MyUmzug extends Umzug {
  getCLI(options?: CommandLineParserOptions) {
    return new MyUmzugCLI(this, options)
  }
}

const myUmug = new MyUmzug(...)

myUmzug.runAsCLI()

@pkit
Copy link
Author

pkit commented Nov 4, 2023

Yep, I've already implemented.
I can read the other people's code (shocking, I know). Was complaining only about the docs. :)

Copy link

github-actions bot commented Nov 6, 2023

Released in v3.5.0-0.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants