-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore(0.1.0): added new soap gateway (#25)
* ✨feat: added new soap gateway (#24) * feat: update inteface gateway #18 * feat!: added exception handler for all controllers #19 & create env #22 * BREAKING CHANGE: change routing /proxy #21 * docs: update with new features * fix: deleted git makers
- Loading branch information
1 parent
2bc83f2
commit fcd4aaf
Showing
14 changed files
with
216 additions
and
75 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
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,44 @@ | ||
using Microsoft.AspNetCore.Mvc; | ||
using Microsoft.AspNetCore.Mvc.Filters; | ||
using System.ServiceModel; | ||
|
||
public class GlobalExceptionFilter : IExceptionFilter | ||
{ | ||
private readonly ILogger<GlobalExceptionFilter> _logger; | ||
|
||
public GlobalExceptionFilter(ILogger<GlobalExceptionFilter> logger) | ||
{ | ||
_logger = logger; | ||
} | ||
//OnException similar to Handler | ||
public void OnException(ExceptionContext context) | ||
{ | ||
_logger.LogError(context.Exception, "Error global de la aplicación."); | ||
|
||
if (context.Exception is InvalidOperationException) | ||
{ | ||
context.Result = new ObjectResult("Error en la operación") { StatusCode = 500 }; | ||
} | ||
else if (context.Exception is TimeoutException) | ||
{ | ||
context.Result = new ObjectResult("Error de tiempo de espera") { StatusCode = 500 }; | ||
} | ||
else if (context.Exception is FaultException<MissingFieldException>) | ||
{ | ||
context.Result = new ObjectResult("FaultException (MissingFieldException | Library has been removed or renamed)") { StatusCode = 500 }; | ||
} | ||
else if (context.Exception is FaultException) | ||
{ | ||
context.Result = new ObjectResult("FaultException (Error en la llamada SOAP)") { StatusCode = 500 }; | ||
} | ||
else if (context.Exception is CommunicationException) | ||
{ | ||
context.Result = new ObjectResult("CommunicationException (Error en la llamada SOAP)") { StatusCode = 500 }; | ||
} | ||
else | ||
{ | ||
context.Result = new ObjectResult("Excepción no controlada") { StatusCode = 500 }; | ||
} | ||
context.ExceptionHandled = true; | ||
} | ||
} |
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
Oops, something went wrong.