Skip to content

Commit

Permalink
Refactor code
Browse files Browse the repository at this point in the history
  • Loading branch information
ldclakmal committed Dec 17, 2020
1 parent 3b295c8 commit abd836e
Showing 1 changed file with 3 additions and 6 deletions.
9 changes: 3 additions & 6 deletions oauth2-ballerina/oauth2_errors.bal
Original file line number Diff line number Diff line change
Expand Up @@ -25,15 +25,12 @@ public type Error OAuth2Error;
# Logs and prepares the `error` as an `oauth2:Error`.
#
# + message - Error message
# + err - `error` instance
# + err - An `error` instance
# + return - Prepared `oauth2:Error` instance
isolated function prepareError(string message, error? err = ()) returns Error {
log:printError(message, err = err);
Error oauth2Error;
if (err is error) {
oauth2Error = OAuth2Error(message, err);
} else {
oauth2Error = OAuth2Error(message);
return OAuth2Error(message, err);
}
return oauth2Error;
return OAuth2Error(message);
}

0 comments on commit abd836e

Please sign in to comment.