Removing some ntfy logs and adding more error handling for 4xx+ errors
This commit is contained in:
parent
2c6e275f4c
commit
509462e118
3 changed files with 9 additions and 11 deletions
|
|
@ -30,17 +30,16 @@ export class NtfyClient {
|
|||
|
||||
async publish(message: Omit<MessageConfig, 'topic'>) {
|
||||
try {
|
||||
await this.httpClient.post(
|
||||
const response = await this.httpClient.post(
|
||||
'/',
|
||||
JSON.stringify({
|
||||
topic: this.topic,
|
||||
...message,
|
||||
}),
|
||||
)
|
||||
this.loggerService.debug('Published ntfy-cation', {
|
||||
topic: this.topic,
|
||||
message,
|
||||
})
|
||||
if (response.status >= 400) {
|
||||
throw new Error(`${response.status} - ${response.statusText}`)
|
||||
}
|
||||
} catch (error: unknown) {
|
||||
this.loggerService.error('ntfy client failed', { error })
|
||||
}
|
||||
|
|
|
|||
|
|
@ -36,7 +36,6 @@ export class NtfyProvider implements OnApplicationBootstrap {
|
|||
|
||||
@Process()
|
||||
async handlePublishJob(job: Job<Omit<MessageConfig, 'topic'>>) {
|
||||
this.loggerService.debug('Handling publish job', { data: job.data })
|
||||
await this.ntfyClient.publish({
|
||||
...job.data,
|
||||
})
|
||||
|
|
|
|||
|
|
@ -52,11 +52,11 @@ export enum MessageTags {
|
|||
}
|
||||
|
||||
export enum MessagePriority {
|
||||
min = '1',
|
||||
low = '2',
|
||||
default = '3',
|
||||
high = '4',
|
||||
max = '5',
|
||||
min = 1,
|
||||
low = 2,
|
||||
default = 3,
|
||||
high = 4,
|
||||
max = 5,
|
||||
}
|
||||
|
||||
export interface MessageConfig {
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue