Skip to content

chore: added apiStandard exception#756

Open
sbansla wants to merge 1 commit intomultiple_response_in_a_resource_csharpfrom
custom_error_response_csharp
Open

chore: added apiStandard exception#756
sbansla wants to merge 1 commit intomultiple_response_in_a_resource_csharpfrom
custom_error_response_csharp

Conversation

@sbansla
Copy link
Copy Markdown
Contributor

@sbansla sbansla commented Jan 18, 2026

Added Exception to twilio-csharp generated code using apiStandard flag.

@sbansla sbansla requested a review from manisha1997 January 18, 2026 17:52
}
catch (JsonException e) {
throw new ApiException(e.Message, e);
throw new ApiStandardException(e.Message, e);
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Are we going the route of creating only 1 exception class and merging the exception fields?

Copy link
Copy Markdown
Contributor Author

@sbansla sbansla Jan 19, 2026

Choose a reason for hiding this comment

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

no, I created different exception, creating one exception would create confusion to the user.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Shouldn't here be then #isApiV1 ?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

got it, but this exception should also be part of normal files, right?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

ReadResponse.mustache is only applicable to v1.0 api standards.
Lets take an example of Message API, So Currently response is kept under Message class. But for v1.x apis, I am creating different classes for each operation, example: MessageReadResponse, MessageFetchResponse etc.
ReadResponse.mustache is used in generating MessageReadResponse.

Thats is why only ApiStandardException exists in here.
PR in twilio-csharp repo: twilio/twilio-csharp#814

}
catch (JsonException e) {
throw new ApiException(e.Message, e);
throw new ApiStandardException(e.Message, e);
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

got it, but this exception should also be part of normal files, right?

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