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

jsMain/IdentityProviderClientJS: wrap all exceptions #63

Merged
merged 3 commits into from
Apr 25, 2023

Conversation

Ingwersaft
Copy link
Member

Wrap all exceptions into a typescript-exposed wrapper exception type.

Typescript clients using our library now can use the errors if the promise fails.

IdentityProviderExceptionJs exposed like this:

export class IdentityProviderExceptionJs /* extends kotlin.Exception */ {
    protected constructor(status: number, message: Nullable<string>);
    get status(): number;
}
export namespace IdentityProviderExceptionJs {
    class CodeMismatch extends IdentityProviderExceptionJs {
        constructor(status: number, message: Nullable<string>);
        get status(): number;
    }
    class ConcurrentModification extends IdentityProviderExceptionJs {
        constructor(status: number, message: Nullable<string>);
        get status(): number;
    }
    class EnableSoftwareTokenMFA extends IdentityProviderExceptionJs {
        constructor(status: number, message: Nullable<string>);
        get status(): number;
    }
    class ExpiredCode extends IdentityProviderExceptionJs {
        constructor(status: number, message: Nullable<string>);
        get status(): number;
    }
    class InternalError extends IdentityProviderExceptionJs {
        constructor(status: number, message: Nullable<string>);
        get status(): number;
    }
    class InvalidLambdaResponse extends IdentityProviderExceptionJs {
        constructor(status: number, message: Nullable<string>);
        get status(): number;
    }
    class InvalidParameter extends IdentityProviderExceptionJs {
        constructor(status: number, message: Nullable<string>);
        get status(): number;
    }
    class InvalidPassword extends IdentityProviderExceptionJs {
        constructor(status: number, message: Nullable<string>);
        get status(): number;
    }
    class InvalidUserPoolConfiguration extends IdentityProviderExceptionJs {
        constructor(status: number, message: Nullable<string>);
        get status(): number;
    }
    class LimitExceeded extends IdentityProviderExceptionJs {
        constructor(status: number, message: Nullable<string>);
        get status(): number;
    }
    class NotAuthorized extends IdentityProviderExceptionJs {
        constructor(status: number, message: Nullable<string>);
        get status(): number;
    }
    class PasswordResetRequired extends IdentityProviderExceptionJs {
        constructor(status: number, message: Nullable<string>);
        get status(): number;
    }
    class ResourceNotFound extends IdentityProviderExceptionJs {
        constructor(status: number, message: Nullable<string>);
        get status(): number;
    }
    class SoftwareTokenMFANotFound extends IdentityProviderExceptionJs {
        constructor(status: number, message: Nullable<string>);
        get status(): number;
    }
    class TooManyFailedAttempts extends IdentityProviderExceptionJs {
        constructor(status: number, message: Nullable<string>);
        get status(): number;
    }
    class TooManyRequests extends IdentityProviderExceptionJs {
        constructor(status: number, message: Nullable<string>);
        get status(): number;
    }
    class UnexpectedLambda extends IdentityProviderExceptionJs {
        constructor(status: number, message: Nullable<string>);
        get status(): number;
    }
    class UserLambdaValidation extends IdentityProviderExceptionJs {
        constructor(status: number, message: Nullable<string>);
        get status(): number;
    }
    class UserNotConfirmed extends IdentityProviderExceptionJs {
        constructor(status: number, message: Nullable<string>);
        get status(): number;
    }
    class UserNotFound extends IdentityProviderExceptionJs {
        constructor(status: number, message: Nullable<string>);
        get status(): number;
    }
    class Unknown extends IdentityProviderExceptionJs {
        constructor(status: number, type: string, message: Nullable<string>);
        get status(): number;
        get type(): string;
    }
    class NonCognitoException extends IdentityProviderExceptionJs {
        constructor(cause: Nullable<Error>, message: Nullable<string>);
    }
}

…escript-exposed wrapper exception type

Typescript clients using our library now can use the errors if the promise fails
@Ingwersaft Ingwersaft requested a review from benjohnde April 25, 2023 14:04
@Ingwersaft Ingwersaft added the enhancement New feature or request label Apr 25, 2023
Marcel Kesselring added 2 commits April 25, 2023 16:21
# Conflicts:
#	src/jsMain/kotlin/IdentityProviderJS.kt
#	src/jsTest/kotlin/com/liftric/cognito/idp/IdentityProviderClientJSTests.kt
@benjohnde
Copy link
Member

LGTM!

@benjohnde benjohnde merged commit 851a4eb into master Apr 25, 2023
@benjohnde benjohnde deleted the feature/expose_exception_to_js branch July 2, 2023 09:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants