From c677b960b6393ff3f5317884f57a34c7bdb32f67 Mon Sep 17 00:00:00 2001 From: Huan LI Date: Fri, 13 Jul 2018 09:25:34 +0800 Subject: [PATCH] return chatie qrcode image when avatar exception (fix #1473) --- src/user/contact.ts | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/src/user/contact.ts b/src/user/contact.ts index 6ee83c7ec..d24014f4f 100644 --- a/src/user/contact.ts +++ b/src/user/contact.ts @@ -24,7 +24,8 @@ import { log, Raven, Sayable, -} from '../config' + qrCodeForChatie, +} from '../config' import { Accessory, } from '../accessory' @@ -578,7 +579,13 @@ export class Contact extends Accessory implements Sayable { public async avatar(): Promise { log.verbose('Contact', 'avatar()') - return this.puppet.contactAvatar(this.id) + try { + const fileBox = await this.puppet.contactAvatar(this.id) + return fileBox + } catch (e) { + log.error('Contact', 'avatar() exception: %s', e.message) + return qrCodeForChatie() + } } /**