Skip to content

Fiddle: add fields to KibaException#44

Merged
krishan711 merged 1 commit into
mainfrom
exception
Jul 10, 2025
Merged

Fiddle: add fields to KibaException#44
krishan711 merged 1 commit into
mainfrom
exception

Conversation

@krishan711
Copy link
Copy Markdown
Contributor

Description

@krishan711 krishan711 requested a review from Copilot July 10, 2025 09:36
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR enhances error handling by extending KibaException with additional context fields and ensuring those fields are populated in the Requester.

  • Extend the KibaException class to include exceptionType and fields properties.
  • Update Requester to extract and pass exceptionType and fields from the error response when throwing exceptions.
  • Document the change in the CHANGELOG.md.

Reviewed Changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated no comments.

File Description
src/requester/requester.ts Pass exceptionType and fields from errorContent to KibaException
src/model/kibaException.ts Added exceptionType and fields properties and updated constructor
CHANGELOG.md Added entry for new KibaException properties
Comments suppressed due to low confidence (4)

src/model/kibaException.ts:2

  • Add JSDoc comments to the KibaException class and its new exceptionType and fields properties to explain their purpose and usage.
export class KibaException extends Error {

src/model/kibaException.ts:7

  • [nitpick] Consider refactoring this constructor to accept a single options object for optional parameters (exceptionType and fields) to improve readability and ease future extensions.
  public constructor(message: string, statusCode?: number, exceptionType?: string, fields?: Record<string, string>) {

src/requester/requester.ts:97

  • Add unit tests to verify that exceptionType and fields from the error response are correctly propagated through KibaException when an error occurs.
        throw new KibaException(errorContent.message, response.status, exceptionType, fields);

src/requester/requester.ts:95

  • Add a type check to ensure errorContent.fields is an object mapping strings to strings before assigning, preventing potential runtime errors if the response shape is unexpected.
        const fields = errorContent.fields || {};

@krishan711 krishan711 merged commit 0147f1b into main Jul 10, 2025
3 checks passed
@krishan711 krishan711 deleted the exception branch July 10, 2025 09:45
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