From 93c230db72cc10aac1a8bf7e174c2972db58301b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=A1=D1=82=D0=B5=D0=BF=D0=B0=D0=BD=D0=BE=D0=B2=20=D0=94?= =?UTF-8?q?=D0=BC=D0=B8=D1=82=D1=80=D0=B8=D0=B9=20=D0=90=D0=BB=D0=B5=D0=BA?= =?UTF-8?q?=D1=81=D0=B0=D0=BD=D0=B4=D1=80=D0=BE=D0=B2=D0=B8=D1=87?= Date: Wed, 26 Jul 2023 18:23:53 +0500 Subject: [PATCH] =?UTF-8?q?=D0=9E=D0=B1=D1=80=D0=B0=D0=B1=D0=BE=D1=82?= =?UTF-8?q?=D0=BA=D0=B0=20=D0=B8=D1=81=D0=BA=D0=BB=D1=8E=D1=87=D0=B5=D0=BD?= =?UTF-8?q?=D0=B8=D1=8F=20FileFormatException=20=D0=BF=D1=80=D0=B8=20?= =?UTF-8?q?=D0=B8=D0=BC=D0=BF=D0=BE=D1=80=D1=82=D0=B5=20=D0=A0=D0=A2=D0=9A?= =?UTF-8?q?-=D0=BF=D0=BB=D0=B0=D0=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Controllers/ProcessMapController.cs | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) diff --git a/AsbCloudWebApi/Controllers/ProcessMapController.cs b/AsbCloudWebApi/Controllers/ProcessMapController.cs index 95f41405..ffa88938 100644 --- a/AsbCloudWebApi/Controllers/ProcessMapController.cs +++ b/AsbCloudWebApi/Controllers/ProcessMapController.cs @@ -204,11 +204,18 @@ namespace AsbCloudWebApi.Controllers using Stream stream = file.OpenReadStream(); - await processMapPlanImportService.ImportAsync(idWell, - idUser.Value, - (options & 1) > 0, - stream, - cancellationToken); + try + { + await processMapPlanImportService.ImportAsync(idWell, + idUser.Value, + (options & 1) > 0, + stream, + cancellationToken); + } + catch (FileFormatException ex) + { + return BadRequest(ex.Message); + } return Ok(); }