Skip to content
This repository has been archived by the owner on Sep 13, 2022. It is now read-only.

Pin version of serialize-error to 2.1.0 #984

Closed
wants to merge 1 commit into from
Closed

Pin version of serialize-error to 2.1.0 #984

wants to merge 1 commit into from

Conversation

chuttam
Copy link
Contributor

@chuttam chuttam commented Nov 13, 2019

Summary

Put serialize-error back to version 2.1.0. It's a node library and later versions use node packages (e.g. util).

Ticket Link

Fixes #983

Checklist

  • Ran make check-style to check for style errors (required for all pull requests)
  • Ran make test to ensure unit tests passed

Test Information

This PR was tested on: iPhone X (simulator)


We've had to do this once before in #822 , but this new attempt is a tiny bit more involved because of type checking rules. The PR does introduce an explicit any usage, which compiles down to the correct serializeError.ErrorObject type.

It's a node library and later versions use node packages (e.g. `util`).
We've had to do this once before in #822 .
@hanzei hanzei added the 2: Dev Review Requires review by a core commiter label Nov 13, 2019
@hanzei hanzei requested review from reflog and migbot November 13, 2019 19:19
@@ -22,7 +22,7 @@ export function dismissError(index: number): ActionFunc {
};
}

export function getLogErrorAction(error: ErrorObject, displayable = false) {
export function getLogErrorAction(error: any, displayable = false) {
Copy link
Contributor Author

@chuttam chuttam Nov 13, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Setting type to any fixes the problem, and the resultant, tsc "compiled" code successfully resolves the desired type to serializeError.ErrorObject.

However changing the any to error: serializeError.ErrorObject fails because v2.1.0 of serializer-error doesn't export ErrorObject.

Could someone with stronger TypeScript fu than me perhaps guide how to create/export an explicit type definition that matches the structure of ErrorObject below?

export type ErrorObject = {
	name?: string;
	stack?: string;
	message?: string;
	code?: string;
}

@reflog
Copy link
Contributor

reflog commented Nov 14, 2019

Closing, since it's already handled by mattermost/mattermost-mobile#3553

@reflog reflog closed this Nov 14, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
2: Dev Review Requires review by a core commiter
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Updated dependency fails RN app
3 participants