From b63c1b50523b982504c244e6d7d61e10d9cddf62 Mon Sep 17 00:00:00 2001 From: Jonathan Jenne Date: Tue, 2 Feb 2021 16:06:41 +0100 Subject: [PATCH] EDMI: Fixes --- Modules.EDMIAPI/Client.vb | 10 ++++++++ Service.EDMIService/EDMIService.vb | 38 ++++++++++++++++-------------- 2 files changed, 30 insertions(+), 18 deletions(-) diff --git a/Modules.EDMIAPI/Client.vb b/Modules.EDMIAPI/Client.vb index 1ae5badc..8e0da08b 100644 --- a/Modules.EDMIAPI/Client.vb +++ b/Modules.EDMIAPI/Client.vb @@ -215,9 +215,19 @@ Public Class Client .AccessRight = oResponse.FileRight, .FullPath = oResponse.FullPath } + + Catch ex As FaultException(Of ObjectDoesNotExistFault) + _logger.Error(ex) + Throw ex + + Catch ex As FaultException + _logger.Error(ex) + Throw ex + Catch ex As Exception _logger.Error(ex) Throw ex + End Try End Function diff --git a/Service.EDMIService/EDMIService.vb b/Service.EDMIService/EDMIService.vb index 19e6a493..4d8f5345 100644 --- a/Service.EDMIService/EDMIService.vb +++ b/Service.EDMIService/EDMIService.vb @@ -395,39 +395,41 @@ Public Class EDMIService End Try End Function - Public Function ListFilesForUser() As DocumentListResponse Implements IEDMIService.ListFilesForUser + Public Function GetFileInfoByObjectId(Data As DocumentInfoRequest) As DocumentInfoResponse Implements IEDMIService.GetFileInfoByObjectId Try - Dim oDatatable = GetFileList() + Dim oAccessRight = GetAccessRightForObjectId(Data.UserId, Data.ObjectId) + Dim oFullPath = GetFullPathForObjectId(Data.ObjectId) - Return New DocumentListResponse() With { - .Datatable = oDatatable + If oFullPath = String.Empty Then + Dim oFault As New ObjectDoesNotExistFault(Data.ObjectId) + Throw New FaultException(Of ObjectDoesNotExistFault)(oFault, oFault.ErrorMessage) + End If + + Return New DocumentInfoResponse With { + .FileRight = oAccessRight, + .FullPath = oFullPath } Catch ex As FaultException + _Logger.Warn("GetFileInfoByObjectId: " & ex.Message) _Logger.Error(ex) Throw ex Catch ex As Exception - _Logger.Error(ex) Dim oDetails As New UnexpectedErrorFault(ex) + _Logger.Warn("GetFileInfoByObjectId: " & oDetails.ErrorMessage) + _Logger.Error(ex) Throw New FaultException(Of UnexpectedErrorFault)(oDetails, oDetails.ErrorMessage) End Try End Function - Public Function GetFileInfoByObjectId(Data As DocumentInfoRequest) As DocumentInfoResponse Implements IEDMIService.GetFileInfoByObjectId + Public Function ListFilesForUser() As DocumentListResponse Implements IEDMIService.ListFilesForUser Try - Dim oAccessRight = GetAccessRightForObjectId(Data.UserId, Data.ObjectId) - Dim oFullPath = GetFullPathForObjectId(Data.ObjectId) - - If oFullPath = String.Empty Then - Dim oDetails As New ObjectDoesNotExistFault(Data.ObjectId) - Throw New FaultException(Of ObjectDoesNotExistFault)(oDetails) - End If + Dim oDatatable = GetFileList() - Return New DocumentInfoResponse With { - .FileRight = oAccessRight, - .FullPath = oFullPath + Return New DocumentListResponse() With { + .Datatable = oDatatable } Catch ex As FaultException @@ -470,7 +472,7 @@ Public Class EDMIService Dim oFullPath As String If oRows.Count = 0 Then - _Logger.Warn("GetFullPathForObjectId: Full path does not exist for on object [{1}]", ObjectId) + _Logger.Warn("GetFullPathForObjectId: Full path does not exist for object [{0}]", ObjectId) oFullPath = String.Empty Else Dim oRow As DataRow = oRows.First() @@ -479,7 +481,7 @@ Public Class EDMIService Return oFullPath Catch ex As Exception - _Logger.Warn("GetFullPathForObjectId: Unexpected Error while getting full path for object [{0}].", ObjectId) + _Logger.Warn("GetFullPathForObjectId: Unexpected Error while getting full path for object [{0}].", ObjectId) _Logger.Error(ex) Return String.Empty End Try