chore(firestore-bigquery-export): improve fs-bq-schema-views when bigQueryID is invalid (rebased)#2782
Conversation
There was a problem hiding this comment.
Code Review
This pull request improves error handling in the gen-schema-view script by providing more descriptive messages for invalid BigQuery Project IDs and removes the onStartResize event from the storage-resize-images extension. Key feedback includes addressing a redundant configuration parsing call that could cause duplicate prompts, improving error logging by avoiding JSON.stringify on Error objects, and ensuring the process exits with a failure code on error. Additionally, the removal of event triggers should be synchronized with the event definitions in extension.yaml to maintain consistency.
| parseConfig() | ||
| .then((parsedConfig) => { | ||
| config = parsedConfig; | ||
| return run(); | ||
| }) |
There was a problem hiding this comment.
Calling parseConfig() here is redundant because the run() function (called on line 80) also invokes await parseConfig() internally. This results in the configuration being parsed twice, which will cause duplicate interactive prompts if the script is run in interactive mode. Consider refactoring the run function to accept the configuration as an optional parameter to avoid this duplication.
| } | ||
| } | ||
|
|
||
| console.log(JSON.stringify(error)); |
There was a problem hiding this comment.
JSON.stringify(error) often returns an empty object {} for standard JavaScript Error objects because their properties (like message and stack) are non-enumerable. Additionally, it can throw an error if the object contains circular references. Consider logging the error object directly with console.error(error) to ensure all details, including the stack trace, are visible.
|
|
||
| console.log(JSON.stringify(error)); | ||
| console.error(error.message); | ||
| process.exit(); |
…ssage when projectIds are invalid
cb558ba to
baa730a
Compare
Fixes #2540
supersedes #2594