Skip to content

Property $retryable not set from ServiceException constructor #1543

@priceld

Description

@priceld

When attempting to set ServiceException props (e.g. $metadata, $fault etc) via the constructor, I find I have no problem until I try to set $retryable. All other values seem to be initialized in the constructor but not $retryable.

This is reproducible with the following nodejs code:

import assert from "node:assert";
import { ServiceException } from "@smithy/smithy-client";

const error = new ServiceException({
  name: "TestError",
  $metadata: { httpStatusCode: 200 },
  $fault: "client",
  $retryable: {},
});

assert.equal("TestError", error.name); // Ok
assert.deepStrictEqual({ httpStatusCode: 200 }, error.$metadata); // Ok
assert.equal("client", error.$fault); // Ok
assert.deepStrictEqual({}, error.$retryable, "Retryable does not match"); // Fails

Which produces the following:

node:internal/modules/run_main:128
    triggerUncaughtException(
    ^

AssertionError [ERR_ASSERTION]: Retryable does not match
+ actual - expected

+ {}
- undefined
...

I couldn't find anything that said if this was an intentional decision or not.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions