public async Task <IActionResult> GetByHash(string imageHash, [FromHeader] string Authorization) { try { _logger.LogInformation("Get image: " + imageHash); var imageBase = await _imagesService.GetByHashAsync(imageHash, Authorization); string jsonContent = JsonConvert.SerializeObject(imageBase); return(Ok(jsonContent)); } catch (Exception ex) { var code = int.Parse(ex.Message.Split(' ').FirstOrDefault(s => s.All(char.IsDigit))); _logger.LogError($"Something went wrong: {ex}"); return(StatusCode(code, ex.Message)); } }