Skip to content

Commit eda8ccd

Browse files
authored
refactor(enforcer): remove forced cast warning (#40)
1 parent d288bfb commit eda8ccd

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

Sources/Casbin/Enforcer.swift

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -403,8 +403,10 @@ extension Enforcer: CoreApi {
403403
if autoBuildRoleLinks {
404404
do {
405405
try self.buildRoleLinks().get()
406-
} catch {
407-
return .failure(error as! CasbinError)
406+
} catch let e as CasbinError {
407+
return .failure(e)
408+
} catch {
409+
return .failure(.OtherErrorMessage(String(describing: error)))
408410
}
409411
}
410412
return registerGFunctions()
@@ -493,4 +495,3 @@ extension Enforcer: CoreApi {
493495
}
494496
}
495497

496-

0 commit comments

Comments
 (0)