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

chore: prettify load-rest-json-error-code-stub.ts #1257

Merged
merged 1 commit into from
Jul 6, 2020

Conversation

trivikr
Copy link
Member

@trivikr trivikr commented Jun 10, 2020

Issue #, if available:
This was noticed when dependabot updated prettier #1200 (review)

Description of changes:

  • prettify load-rest-json-error-code-stub.ts
  • it's currently prettified when merging into protocols file. For example:
    const loadRestJsonErrorCode = (output: __HttpResponse, data: any): string => {
    const findKey = (object: any, key: string) =>
    Object.keys(object).find(k => k.toLowerCase() === key.toLowerCase());
    const sanitizeErrorCode = (rawValue: string): string => {
    let cleanValue = rawValue;
    if (cleanValue.indexOf(":") >= 0) {
    cleanValue = cleanValue.split(":")[0];
    }
    if (cleanValue.indexOf("#") >= 0) {
    cleanValue = cleanValue.split("#")[1];
    }
    return cleanValue;
    };
    const headerKey = findKey(output.headers, "x-amzn-errortype");
    if (headerKey !== undefined) {
    return sanitizeErrorCode(output.headers[headerKey]);
    }
    if (data.code !== undefined) {
    return sanitizeErrorCode(data.code);
    }
    if (data["__type"] !== undefined) {
    return sanitizeErrorCode(data["__type"]);
    }
    return "";
    };

By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.

@aws-sdk-js-automation

This comment has been minimized.

@trivikr trivikr force-pushed the prettify-loadRestJsonErrorCode branch from cafec0d to be25af0 Compare June 15, 2020 23:39
@codecov-commenter
Copy link

codecov-commenter commented Jun 15, 2020

Codecov Report

Merging #1257 into master will not change coverage.
The diff coverage is n/a.

Impacted file tree graph

@@           Coverage Diff           @@
##           master    #1257   +/-   ##
=======================================
  Coverage   89.34%   89.34%           
=======================================
  Files         152      152           
  Lines        3145     3145           
  Branches      579      579           
=======================================
  Hits         2810     2810           
  Misses        335      335           

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update d018293...6ec2c70. Read the comment docs.

@trivikr trivikr force-pushed the prettify-loadRestJsonErrorCode branch from 890d9cb to 6ec2c70 Compare July 6, 2020 14:21
@trivikr trivikr merged commit 0c0383c into aws:master Jul 6, 2020
@trivikr trivikr deleted the prettify-loadRestJsonErrorCode branch July 6, 2020 22:42
@github-actions
Copy link

This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs and link to relevant comments in this thread.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Jan 19, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants