-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Restructured error management in BackendAccess; Introduced BackendMoo…
…dleApiUnreachableException.cs and new error message in LmsLoginDialog.razor
- Loading branch information
1 parent
2484b65
commit f344ece
Showing
10 changed files
with
151 additions
and
5 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
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
15 changes: 15 additions & 0 deletions
15
BusinessLogic/ErrorManagement/BackendAccess/BackendHttpRequestException.cs
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,15 @@ | ||
using System.Net; | ||
|
||
namespace BusinessLogic.ErrorManagement.BackendAccess; | ||
|
||
public class BackendHttpRequestException : HttpRequestException | ||
{ | ||
|
||
public string? ErrorType { get; set; } | ||
|
||
public BackendHttpRequestException(string? message, Exception? inner, HttpStatusCode? statusCode, string? type) | ||
: base(message, inner, statusCode) | ||
{ | ||
ErrorType = type; | ||
} | ||
} |
16 changes: 16 additions & 0 deletions
16
BusinessLogic/ErrorManagement/BackendAccess/BackendMoodleApiUnreachableException.cs
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,16 @@ | ||
namespace BusinessLogic.ErrorManagement.BackendAccess; | ||
|
||
public class BackendMoodleApiUnreachableException : Exception | ||
{ | ||
public BackendMoodleApiUnreachableException() | ||
{ | ||
} | ||
|
||
public BackendMoodleApiUnreachableException(string message) : base(message) | ||
{ | ||
} | ||
|
||
public BackendMoodleApiUnreachableException(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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
namespace BusinessLogic.ErrorManagement.BackendAccess; | ||
|
||
public static class ErrorCodes | ||
{ | ||
/// <summary> | ||
/// Error code for using an invalid token | ||
/// </summary> | ||
public const string LmsTokenInvalid = "invalid_token"; | ||
|
||
/// <summary> | ||
/// Error code for wrong username or password | ||
/// </summary> | ||
public const string InvalidLogin = "invalid_login"; | ||
|
||
/// <summary> | ||
/// Error if a resource is not found | ||
/// </summary> | ||
public const string NotFound = "not_found"; | ||
|
||
/// <summary> | ||
/// Error if a resource is forbidden | ||
/// </summary> | ||
public const string Forbidden = "forbidden"; | ||
|
||
/// <summary> | ||
/// Error if a request is invalid | ||
/// </summary> | ||
public const string ValidationError = "validation_error"; | ||
|
||
/// <summary> | ||
/// Error code for unknown errors | ||
/// </summary> | ||
public const string UnknownError = "unknown_error"; | ||
|
||
/// <summary> | ||
/// Error code for generic LMS errors | ||
/// </summary> | ||
public const string LmsError = "lms_error"; | ||
|
||
/// <summary> | ||
/// Error code when a world could not be created | ||
/// </summary> | ||
public const string WorldCreationErrorDuplicate = "world_creation_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
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