Open SaadBazaz opened 2 weeks ago
Can this be done here? https://github.com/UpstreetAI/monorepo/blob/2fcdfa1d2a847d32c36c5ce700f8feb906eff43c/packages/usdk/cli.js#L2039
Pseudocode:
try {
await program.parseAsync();
}
catch(error) {
// 1. log error in console
console.error(error)
// 2. show stack trace
// 3. Write a log to file
// 4. Display error, and path to log file
console.info("USDK crashed. The error log is in ", pathToErrorFile)
}
Yes definitely a good addition, would help bridge crash/error context gap between devs and users
Logs are already being written via winston
.
Although it is not currently done, we could print the log location on a crash.
Added a PR for better more reliable log dump to file and display log file path on crash: https://github.com/UpstreetAI/monorepo/pull/506
Commands like
usdk create
can crash at any point. Currently, it's hard for developers to share logs as they have to copy-paste their entire chat.Having a log file with "redacted" tokens might make it easiers for devs to share errors. Also, the content of the logfile can be directly uploaded to Telemetry like Sentry for error capture.
Possible approach
We can try-catch the CLI and then dump the stack trace + questionsSoFar into a .log file, stored in either the same folder as a file called
.usdk-crash.dump
maybe. Or, could be a JSON file. Really depends on international standards. See how npm manages it here (this should be a very helpful example, maybe we can just piggyback off of npm's or node's existing crash mechanisms).I want more thoughts on this.