Created
December 15, 2014 18:21
-
-
Save bjartwolf/f3538780c28f09a6c9c4 to your computer and use it in GitHub Desktop.
logging and rhrowing exceptions
This file contains hidden or 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
let logResultOfSending (logger: IEventIDLog) (receiverNumber : string) (body : string) (status : SmsStatus) = | |
match status with | |
| Response result -> | |
let logg = logresponse receiverNumber body result | |
match result with | |
| Success -> logg SmsSent.EventId logger.Info | |
| Fail -> logg SmsError.EventId logger.Error | |
| Error ex -> | |
logger.Error(SmsError.EventId, "error sending sms", ex) | |
status | |
// NServiceBus handles recovery from failure based on the app throwing exceptions | |
let throwExceptionsWhenMessagesAreNotSent(status : SmsStatus) = | |
match status with | |
| Response result -> | |
match result with | |
| Success -> () | |
| Fail -> | |
raise (SmsException("delivery failed", result)) | |
| Error e -> | |
raise e |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment