From 3aa87cc26fd58836b82c067b58a47e08e30a7784 Mon Sep 17 00:00:00 2001
From: crupest <crupest@outlook.com>
Date: Thu, 4 Jun 2020 00:18:50 +0800
Subject: refactor(front): Make codes lint-clean!

---
 Timeline/ClientApp/src/user/ChangeAvatarDialog.tsx | 11 ++++++-----
 1 file changed, 6 insertions(+), 5 deletions(-)

(limited to 'Timeline/ClientApp/src/user/ChangeAvatarDialog.tsx')

diff --git a/Timeline/ClientApp/src/user/ChangeAvatarDialog.tsx b/Timeline/ClientApp/src/user/ChangeAvatarDialog.tsx
index e082d5a0..f7b25252 100644
--- a/Timeline/ClientApp/src/user/ChangeAvatarDialog.tsx
+++ b/Timeline/ClientApp/src/user/ChangeAvatarDialog.tsx
@@ -11,6 +11,7 @@ import {
 import { AxiosError } from 'axios';
 
 import ImageCropper, { Clip, applyClipToImage } from '../common/ImageCropper';
+import { UiLogicError } from '../common';
 
 export interface ChangeAvatarDialogProps {
   open: boolean;
@@ -107,11 +108,11 @@ const ChangeAvatarDialog: React.FC<ChangeAvatarDialogProps> = (props) => {
       clip.width === 0 ||
       file == null
     ) {
-      throw new Error('Invalid state.');
+      throw new UiLogicError();
     }
 
     setState('processcrop');
-    applyClipToImage(cropImgElement, clip, file.type).then((b) => {
+    void applyClipToImage(cropImgElement, clip, file.type).then((b) => {
       setResultBlob(b);
     });
   }, [cropImgElement, clip, file]);
@@ -130,7 +131,7 @@ const ChangeAvatarDialog: React.FC<ChangeAvatarDialogProps> = (props) => {
 
   const upload = React.useCallback(() => {
     if (resultBlob == null) {
-      throw new Error('Invalid state.');
+      throw new UiLogicError();
     }
 
     setState('uploading');
@@ -147,7 +148,7 @@ const ChangeAvatarDialog: React.FC<ChangeAvatarDialogProps> = (props) => {
 
   const createPreviewRow = (): React.ReactElement => {
     if (resultUrl == null) {
-      throw new Error('Invalid state.');
+      throw new UiLogicError();
     }
     return (
       <Row className="justify-content-center">
@@ -182,7 +183,7 @@ const ChangeAvatarDialog: React.FC<ChangeAvatarDialogProps> = (props) => {
           );
         } else if (state === 'crop') {
           if (fileUrl == null) {
-            throw new Error('Invalid state.');
+            throw new UiLogicError();
           }
           return (
             <>
-- 
cgit v1.2.3

