-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Show extension load error on require
Before this commit, any errors in loading the extension wrapper module wouldn't be shown if the `Extension` object wasn't started, and the `BaseClient` object would not attempt to start the extension if the extension wrapper wasn't loaded, meaning that errors in loading the extension wrapper were, in practice, never shown. This commit changes those errors to be emitted when the extension wrapper module is required, instead of when the `Extension` object is started.
- Loading branch information
Showing
4 changed files
with
25 additions
and
20 deletions.
There are no files selected for viewing
6 changes: 6 additions & 0 deletions
6
packages/nodejs/.changesets/show-extension-load-errors-when-required.md
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
--- | ||
bump: "patch" | ||
type: "fix" | ||
--- | ||
|
||
Show errors in loading the extension when the `@appsignal/nodejs` module is required. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -16,19 +16,7 @@ export class Extension { | |
* Starts the extension. | ||
*/ | ||
public start() { | ||
try { | ||
extension.start() | ||
} catch (e) { | ||
if (e.message === "Extension module not loaded") { | ||
console.warn( | ||
"AppSignal extension not loaded. This could mean that your current environment isn't supported, or that another error has occurred." | ||
) | ||
} else { | ||
console.error( | ||
`Failed to load AppSignal extension with error: ${e.message}. Please email us at [email protected] for support.` | ||
) | ||
} | ||
} | ||
extension.start() | ||
} | ||
|
||
/** | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters