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 1b363c3 commit ddac374
Showing 1 changed file with 4 additions and 7 deletions.
11 changes: 4 additions & 7 deletions auth-ballerina/auth_errors.bal
Original file line number Diff line number Diff line change
Expand Up @@ -23,18 +23,15 @@ public type AuthError distinct error;
# Represents the Auth module related error.
public type Error AuthError;

# Log and prepare `error` as a `auth:Error`.
# Logs and prepares the `error` as an `auth:Error`.
#
# + message - Error message
# + err - `error` instance
# + err - An `error` instance
# + return - Prepared `auth:Error` instance
isolated function prepareError(string message, error? err = ()) returns Error {
log:printError(message, err = err);
Error authError;
if (err is error) {
authError = AuthError(message, err);
} else {
authError = AuthError(message);
return AuthError(message, err);
}
return authError;
return AuthError(message);
}

0 comments on commit ddac374

Please sign in to comment.