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

feat: remove status key in ApplicationError class, update meta key to unknown type #1338

Merged
merged 3 commits into from
Mar 10, 2021

Conversation

karrui
Copy link
Contributor

@karrui karrui commented Mar 10, 2021

Problem

This PR removes the unused status class variable in ApplicationError class that may sometimes cause confusion when poring through logs for issues, since the default value is 500.

Also updates the meta key in ApplicationError to accept anything, since we may want to store more info from the creation of the error; e.g. storing original error that resulted in an ApplicationError being created for logging purposes.

Solution

Features:

  • remove status key in ApplicationError class and all its usages
  • update meta key in ApplicationError to unknown type

@karrui
Copy link
Contributor Author

karrui commented Mar 10, 2021

Sorry missed some tests; fixing tests, will reopen for review later!

@karrui karrui marked this pull request as draft March 10, 2021 05:45
@karrui karrui marked this pull request as ready for review March 10, 2021 08:19
@karrui
Copy link
Contributor Author

karrui commented Mar 10, 2021

Tested with putting another error inside meta, works fine (in JS Console)

let testErr = new ApplicationError('test message', {error: new Error('another error')})
console.dir(testErr)

output:

ApplicationError: test message
    at <anonymous>:1:15
message: "test message"
meta:
error: Error: another error at <anonymous>:1:60
message: "another error"
stack: "Error: another error↵    at <anonymous>:1:60"
__proto__: Object
__proto__: Object
name: "ApplicationError"
stack: "ApplicationError: test message↵    at <anonymous>:1:15"
__proto__: Error

@liangyuanruo liangyuanruo merged commit 9cb552b into develop Mar 10, 2021
@liangyuanruo liangyuanruo deleted the feat/remove-status-app-error branch March 10, 2021 09:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants