Skip to content

Commit e27646f

Browse files
committed
Simplify OauthException.toMap()
1 parent 764a605 commit e27646f

File tree

1 file changed

+4
-10
lines changed

1 file changed

+4
-10
lines changed
Lines changed: 4 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,8 @@
11
package nl.myndocs.oauth2.exception
22

3-
fun OauthException.toMap(): Map<String, String> {
4-
5-
val mutableMapOf = mutableMapOf<String, String>(
6-
"error" to this.error.errorName
7-
)
8-
9-
if (this.errorDescription != null) {
10-
mutableMapOf["error_description"] = this.errorDescription
3+
fun OauthException.toMap(): Map<String, String> = with(mutableMapOf("error" to error.errorName)) {
4+
if (errorDescription != null) {
5+
this["error_description"] = errorDescription
116
}
12-
13-
return mutableMapOf.toMap()
7+
toMap()
148
}

0 commit comments

Comments
 (0)