-
Notifications
You must be signed in to change notification settings - Fork 221
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1100 from microsoft/feature/error-description
adds error handling support
- Loading branch information
Showing
61 changed files
with
4,423 additions
and
3,402 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -18,5 +18,6 @@ | |
"cSpell.words": [ | ||
"npmrc", | ||
"serializers" | ||
] | ||
], | ||
"java.configuration.updateBuildConfiguration": "automatic" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
// ------------------------------------------------------------------------------ | ||
// Copyright (c) Microsoft Corporation. All Rights Reserved. Licensed under the MIT License. See License in the project root for license information. | ||
// ------------------------------------------------------------------------------ | ||
using System; | ||
|
||
namespace Microsoft.Kiota.Abstractions; | ||
|
||
/// <summary> | ||
/// Parent type for exceptions thrown by the client when receiving failed responses to its requests. | ||
/// </summary> | ||
public class ApiException : Exception | ||
{ | ||
/// <inheritdoc/> | ||
public ApiException(): base() | ||
{ | ||
|
||
} | ||
/// <inheritdoc/> | ||
public ApiException(string message) : base(message) | ||
{ | ||
} | ||
/// <inheritdoc/> | ||
public ApiException(string message, Exception innerException) : base(message, innerException) | ||
{ | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
package abstractions | ||
|
||
import "fmt" | ||
|
||
// ApiError is the parent type for errors thrown by the client when receiving failed responses to its requests | ||
type ApiError struct { | ||
Message string | ||
} | ||
|
||
func (e *ApiError) Error() string { | ||
if len(e.Message) > 0 { | ||
return fmt.Sprint(e.Message) | ||
} else { | ||
return "error status code received from the API" | ||
} | ||
} | ||
|
||
// NewApiError creates a new ApiError instance | ||
func NewApiError() *ApiError { | ||
return &ApiError{} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
package abstractions | ||
|
||
// ResponseHandler handler to implement when a request's response should be handled a specific way. | ||
type ResponseHandler func(response interface{}) (interface{}, error) | ||
type ResponseHandler func(response interface{}, errorMappings ErrorMappings) (interface{}, error) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
21 changes: 21 additions & 0 deletions
21
abstractions/java/lib/src/main/java/com/microsoft/kiota/ApiException.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
package com.microsoft.kiota; | ||
|
||
/** Parent type for exceptions thrown by the client when receiving failed responses to its requests. */ | ||
public class ApiException extends Exception { | ||
/** {@inheritdoc} */ | ||
public ApiException() { | ||
super(); | ||
} | ||
/** {@inheritdoc} */ | ||
public ApiException(String message) { | ||
super(message); | ||
} | ||
/** {@inheritdoc} */ | ||
public ApiException(String message, Throwable cause) { | ||
super(message, cause); | ||
} | ||
/** {@inheritdoc} */ | ||
public ApiException(Throwable cause) { | ||
super(cause); | ||
} | ||
} |
12 changes: 11 additions & 1 deletion
12
abstractions/java/lib/src/main/java/com/microsoft/kiota/NativeResponseHandler.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.