Skip to content

Commit

Permalink
code cleanUp
Browse files Browse the repository at this point in the history
  • Loading branch information
MarcoRecchioni committed Mar 26, 2021
1 parent d0d291b commit b2d822f
Showing 1 changed file with 32 additions and 16 deletions.
48 changes: 32 additions & 16 deletions BreinifyApi/engine/BreinifyExecutor.swift
Original file line number Diff line number Diff line change
Expand Up @@ -49,13 +49,17 @@ open class BreinifyExecutor {
success successBlock: @escaping BreinEngine.apiSuccess,
failure failureBlock: @escaping BreinEngine.apiFailure) throws {

try activity(breinActivity,
user: user,
activityType: activityType,
category: category,
description: description,
success: successBlock,
failure: failureBlock)
do {
try activity(breinActivity,
user: user,
activityType: activityType,
category: category,
description: description,
success: successBlock,
failure: failureBlock)
} catch {
BreinLogger.shared.log(error.localizedDescription)
}
}

/// Invokes an activity request
Expand Down Expand Up @@ -87,7 +91,11 @@ open class BreinifyExecutor {
breinActivity.setCategory(category)
breinActivity.setDescription(description)

try breinActivity.getBreinEngine()?.sendActivity(breinActivity, success: successBlock, failure: failureBlock)
do {
try breinActivity.getBreinEngine()?.sendActivity(breinActivity, success: successBlock, failure: failureBlock)
} catch {
BreinLogger.shared.log(error.localizedDescription)
}
}

/// Invokes a lookup request
Expand All @@ -103,11 +111,15 @@ open class BreinifyExecutor {
success successBlock: @escaping BreinEngine.apiSuccess,
failure failureBlock: @escaping BreinEngine.apiFailure) throws {

return try lookup(breinLookup,
user: user,
dimension: dimension,
success: successBlock,
failure: failureBlock)
do {
return try lookup(breinLookup,
user: user,
dimension: dimension,
success: successBlock,
failure: failureBlock)
} catch {
BreinLogger.shared.log(error.localizedDescription)
}
}

/// Invokes a lookup request
Expand All @@ -133,9 +145,13 @@ open class BreinifyExecutor {
breinLookup.setUser(user)
breinLookup.setBreinDimension(dimension)

return try breinLookup.getBreinEngine()!.performLookUp(breinLookup,
success: successBlock,
failure: failureBlock)
do {
return try breinLookup.getBreinEngine()!.performLookUp(breinLookup,
success: successBlock,
failure: failureBlock)
} catch {
BreinLogger.shared.log(error.localizedDescription)
}
}

/// shutdown of the engine
Expand Down

0 comments on commit b2d822f

Please sign in to comment.