fix: http error for support ticket (#7746)

This commit is contained in:
Laurin 2026-02-27 10:58:48 +01:00 committed by GitHub
parent 37937ea630
commit ade45f5a70
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 8 additions and 4 deletions

View file

@ -0,0 +1,5 @@
---
'hive': patch
---
fix unexpected error for support tickets in case the user already exists within zendesk.

View file

@ -117,7 +117,7 @@ export class HttpClient {
}
}
class HiveHttpClientError extends Error {
export class HiveHttpClientError extends Error {
constructor(
message: string,
public code: string,

View file

@ -1,12 +1,11 @@
import { createHash } from 'node:crypto';
import { HTTPError } from 'got';
import { Inject, Injectable, Scope } from 'graphql-modules';
import { z } from 'zod';
import { Organization, SupportTicketPriority, SupportTicketStatus } from '../../../shared/entities';
import { atomic } from '../../../shared/helpers';
import { AuditLogRecorder } from '../../audit-logs/providers/audit-log-recorder';
import { Session } from '../../auth/lib/authz';
import { HttpClient } from '../../shared/providers/http-client';
import { HiveHttpClientError, HttpClient } from '../../shared/providers/http-client';
import { Logger } from '../../shared/providers/logger';
import { Storage } from '../../shared/providers/storage';
import { OrganizationManager } from './../../organization/providers/organization-manager';
@ -347,7 +346,7 @@ export class SupportManager {
},
);
} catch (err) {
if (err instanceof HTTPError && err.code === '422') {
if (err instanceof HiveHttpClientError && err.code === '422') {
// This user is already a member of this organization.
this.logger.debug(
'The user was already connected to the zendesk organization. (organization: %s, user: %s, zendeskUserId: %d, zendeskOrganizationId: %d)',