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

Fix typeError in lib/responseToError.js #817

Merged
merged 1 commit into from
Jul 3, 2018
Merged

Conversation

laurenzlong
Copy link
Contributor

Description

Certain API calls (such as ones to cloudfunctions) return response bodies which are a JSON string. This change attempts to parse the string to retrieve error message and prevents type errors such as:

[2018-07-03T16:58:35.452Z] TypeError: Cannot create property 'error' on string '{
"error": {
"code": 503,
"message": "The service is currently unavailable.",
"status": "UNAVAILABLE",
"details": [
{
"@type": "type.googleapis.com/google.rpc.DebugInfo",
"detail": "[ORIGINAL ERROR] RPC::DEADLINE_EXCEEDED: "
}
]
}
}
'

Scenarios Tested

Sample Commands

@mbleigh mbleigh assigned laurenzlong and unassigned mbleigh Jul 3, 2018
@laurenzlong laurenzlong merged commit 5ad18b3 into master Jul 3, 2018
@laurenzlong laurenzlong deleted the ll-fixresponsetoerrr branch July 3, 2018 18:00
joehan pushed a commit that referenced this pull request Apr 26, 2024
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