Skip to content

Commit

Permalink
try and fix faulty error-catching logic in bulkCreation
Browse files Browse the repository at this point in the history
  • Loading branch information
dularion committed May 12, 2018
1 parent ac3b843 commit 6950808
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions grails-app/services/streama/BulkCreateService.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,7 @@ class BulkCreateService {
} else {
fileResult = extractDataForEpisode(existingTvShow, seasonNumber, episodeNumber, fileResult, tvShowId)
}
} catch (Exception ex) {
} catch (ex) {
log.error("Error occured while trying to retrieve data from TheMovieDB. Please check your API-Key.")
fileResult.status = MATCHER_STATUS.LIMIT_REACHED
fileResult.name = name
Expand Down Expand Up @@ -189,11 +189,16 @@ class BulkCreateService {
def result = []
fileMatchers.each{ fileMatcher ->
String type = fileMatcher.type
def entity
if(fileMatcher.status == MATCHER_STATUS.EXISTING){
return
}

def entity = theMovieDbService.createEntityFromApiId(type, fileMatcher.apiId, fileMatcher)
try{
entity = theMovieDbService.createEntityFromApiId(type, fileMatcher.apiId, fileMatcher)
}catch (e){
log.error(e.message)
}
if(!entity){
fileMatcher.status = MATCHER_STATUS.LIMIT_REACHED
result.add(fileMatcher)
Expand Down

0 comments on commit 6950808

Please sign in to comment.