diff --git a/src/RestApiClientSharp/RestApiClient.Rest.cs b/src/RestApiClientSharp/RestApiClient.Rest.cs index 898a11c..3051265 100644 --- a/src/RestApiClientSharp/RestApiClient.Rest.cs +++ b/src/RestApiClientSharp/RestApiClient.Rest.cs @@ -335,13 +335,18 @@ protected virtual IRestApiRequestRespone ValidateResponse(RestResponse? response if (!IsOnline) return apiRsponeResult; try { - // If there is no file specified - if (file is null && localFilePath is null) - // and there are no additional parameters supplied, throw - if (parameters?.Count == 0) + // If there is no file specified and there are no additional parameters supplied, throw + if (parameters?.Count == 0) + { + if (file is null) + throw new ArgumentNullException( + nameof(file), + $"No file, localFilePath and paramaters have been provided! Set at least one of those three parameters!"); + else if (localFilePath is null) throw new ArgumentNullException( - $"{nameof(file)} / {nameof(localFilePath)} / {nameof(parameters)}", + nameof(localFilePath), $"No file, localFilePath and paramaters have been provided! Set at least one of those three parameters!"); + } if (RestClient is null) { UpdateRestClientInstance();