Skip to content

Commit

Permalink
fix(server): fix error log in server (#505)
Browse files Browse the repository at this point in the history
Signed-off-by: maslow <wangfugen@126.com>
  • Loading branch information
maslow authored Dec 9, 2022
1 parent 805f6b6 commit 7eaefd5
Show file tree
Hide file tree
Showing 7 changed files with 10 additions and 12 deletions.
1 change: 1 addition & 0 deletions server/src/applications/application-task.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -130,5 +130,6 @@ export class ApplicationTaskService {
phase: ApplicationPhase.Deleted,
},
})
this.logger.log(`Application ${app.appid} updated to phase deleted`)
}
}
1 change: 1 addition & 0 deletions server/src/core/application.cr.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ export class ApplicationCoreService {
const res = await this.k8sClient.coreV1Api.readNamespace(namespace)
return res.body
} catch (err) {
if (err?.response?.body?.reason === 'NotFound') return null
this.logger.error(err)
return null
}
Expand Down
6 changes: 2 additions & 4 deletions server/src/core/database.cr.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -79,11 +79,9 @@ export class DatabaseCoreService {
)
return Database.fromObject(res.body)
} catch (err) {
if (err?.response?.body?.reason === 'NotFound') return null
this.logger.error(err)
if (err?.response?.body?.reason === 'NotFound') {
return null
}
throw err
return null
}
}

Expand Down
6 changes: 2 additions & 4 deletions server/src/core/gateway.cr.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -45,11 +45,9 @@ export class GatewayCoreService {
)
return Gateway.fromObject(res.body)
} catch (err) {
if (err?.response?.body?.reason === 'NotFound') return null
this.logger.error(err)
if (err?.response?.body?.reason === 'NotFound') {
return null
}
throw err
return null
}
}

Expand Down
6 changes: 2 additions & 4 deletions server/src/core/oss-user.cr.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -64,11 +64,9 @@ export class OSSUserCoreService {
)
return OSSUser.fromObject(res.body)
} catch (err) {
if (err?.response?.body?.reason === 'NotFound') return null
this.logger.error(err)
if (err?.response?.body?.reason === 'NotFound') {
return null
}
throw err
return null
}
}

Expand Down
1 change: 1 addition & 0 deletions server/src/instance/instance-task.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,7 @@ export class InstanceTaskService {
phase: ApplicationPhase.Started,
},
})
this.logger.debug(`Application ${app.appid} updated to phase started`)
} catch (error) {
this.logger.error(error)
}
Expand Down
1 change: 1 addition & 0 deletions server/src/instance/instance.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -215,6 +215,7 @@ export class InstanceService {
)
return res.body
} catch (error) {
if (error?.response?.body?.reason === 'NotFound') return null
return null
}
}
Expand Down

0 comments on commit 7eaefd5

Please sign in to comment.