update 优化oss配置错误时的错误信息

This commit is contained in:
youjie 2021-08-19 17:16:36 +08:00
parent 36fae5c926
commit 89a75e7800
4 changed files with 14 additions and 14 deletions

View File

@ -36,7 +36,7 @@ public class AliyunCloudStorageStrategy extends AbstractCloudStorageStrategy {
client = new OSSClient(properties.getEndpoint(), credentialProvider, configuration); client = new OSSClient(properties.getEndpoint(), credentialProvider, configuration);
createBucket(); createBucket();
} catch (Exception e) { } catch (Exception e) {
throw new OssException("阿里云存储配置错误! 请检查系统配置!"); throw new OssException("阿里云存储配置错误! 请检查系统配置:[" + e.getMessage() + "]");
} }
} }
@ -51,7 +51,7 @@ public class AliyunCloudStorageStrategy extends AbstractCloudStorageStrategy {
createBucketRequest.setCannedACL(CannedAccessControlList.PublicRead); createBucketRequest.setCannedACL(CannedAccessControlList.PublicRead);
client.createBucket(createBucketRequest); client.createBucket(createBucketRequest);
} catch (Exception e) { } catch (Exception e) {
throw new OssException("创建Bucket失败, 请核对阿里云配置信息"); throw new OssException("创建Bucket失败, 请核对阿里云配置信息:[" + e.getMessage() + "]");
} }
} }
@ -72,7 +72,7 @@ public class AliyunCloudStorageStrategy extends AbstractCloudStorageStrategy {
metadata.setContentType(contentType); metadata.setContentType(contentType);
client.putObject(new PutObjectRequest(properties.getBucketName(), path, inputStream, metadata)); client.putObject(new PutObjectRequest(properties.getBucketName(), path, inputStream, metadata));
} catch (Exception e) { } catch (Exception e) {
throw new OssException("上传文件失败,请检查阿里云配置信息"); throw new OssException("上传文件失败,请检查阿里云配置信息:[" + e.getMessage() + "]");
} }
return new UploadResult().setUrl(getEndpointLink() + "/" + path).setFilename(path); return new UploadResult().setUrl(getEndpointLink() + "/" + path).setFilename(path);
} }
@ -83,7 +83,7 @@ public class AliyunCloudStorageStrategy extends AbstractCloudStorageStrategy {
try { try {
client.deleteObject(properties.getBucketName(), path); client.deleteObject(properties.getBucketName(), path);
} catch (Exception e) { } catch (Exception e) {
throw new OssException("上传文件失败,请检查阿里云配置信息"); throw new OssException("上传文件失败,请检查阿里云配置信息:[" + e.getMessage() + "]");
} }
} }

View File

@ -32,7 +32,7 @@ public class MinioCloudStorageStrategy extends AbstractCloudStorageStrategy {
.build(); .build();
createBucket(); createBucket();
} catch (Exception e) { } catch (Exception e) {
throw new OssException("Minio存储配置错误! 请检查系统配置!"); throw new OssException("Minio存储配置错误! 请检查系统配置:[" + e.getMessage() + "]");
} }
} }
@ -51,7 +51,7 @@ public class MinioCloudStorageStrategy extends AbstractCloudStorageStrategy {
.config(getPolicy(bucketName, PolicyType.READ)) .config(getPolicy(bucketName, PolicyType.READ))
.build()); .build());
} catch (Exception e) { } catch (Exception e) {
throw new OssException("创建Bucket失败, 请核对Minio配置信息"); throw new OssException("创建Bucket失败, 请核对Minio配置信息:[" + e.getMessage() + "]");
} }
} }
@ -75,7 +75,7 @@ public class MinioCloudStorageStrategy extends AbstractCloudStorageStrategy {
.stream(inputStream, inputStream.available(), -1) .stream(inputStream, inputStream.available(), -1)
.build()); .build());
} catch (Exception e) { } catch (Exception e) {
throw new OssException("上传文件失败请核对Minio配置信息"); throw new OssException("上传文件失败请核对Minio配置信息:[" + e.getMessage() + "]");
} }
return new UploadResult().setUrl(getEndpointLink() + "/" + path).setFilename(path); return new UploadResult().setUrl(getEndpointLink() + "/" + path).setFilename(path);
} }

View File

@ -44,7 +44,7 @@ public class QcloudCloudStorageStrategy extends AbstractCloudStorageStrategy {
client = new COSClient(credentials, clientConfig); client = new COSClient(credentials, clientConfig);
createBucket(); createBucket();
} catch (Exception e) { } catch (Exception e) {
throw new OssException("腾讯云存储配置错误! 请检查系统配置!"); throw new OssException("腾讯云存储配置错误! 请检查系统配置:[" + e.getMessage() + "]");
} }
} }
@ -59,7 +59,7 @@ public class QcloudCloudStorageStrategy extends AbstractCloudStorageStrategy {
createBucketRequest.setCannedAcl(CannedAccessControlList.PublicRead); createBucketRequest.setCannedAcl(CannedAccessControlList.PublicRead);
client.createBucket(createBucketRequest); client.createBucket(createBucketRequest);
} catch (Exception e) { } catch (Exception e) {
throw new OssException("创建Bucket失败, 请核对腾讯云配置信息"); throw new OssException("创建Bucket失败, 请核对腾讯云配置信息:[" + e.getMessage() + "]");
} }
} }
@ -80,7 +80,7 @@ public class QcloudCloudStorageStrategy extends AbstractCloudStorageStrategy {
metadata.setContentType(contentType); metadata.setContentType(contentType);
client.putObject(new PutObjectRequest(properties.getBucketName(), path, inputStream, metadata)); client.putObject(new PutObjectRequest(properties.getBucketName(), path, inputStream, metadata));
} catch (Exception e) { } catch (Exception e) {
throw new OssException("上传文件失败,请检查腾讯云配置信息"); throw new OssException("上传文件失败,请检查腾讯云配置信息:[" + e.getMessage() + "]");
} }
return new UploadResult().setUrl(getEndpointLink() + "/" + path).setFilename(path); return new UploadResult().setUrl(getEndpointLink() + "/" + path).setFilename(path);
} }
@ -91,7 +91,7 @@ public class QcloudCloudStorageStrategy extends AbstractCloudStorageStrategy {
try { try {
client.deleteObject(new DeleteObjectRequest(properties.getBucketName(), path)); client.deleteObject(new DeleteObjectRequest(properties.getBucketName(), path));
} catch (Exception e) { } catch (Exception e) {
throw new OssException("上传文件失败,请检腾讯云查配置信息"); throw new OssException("上传文件失败,请检腾讯云查配置信息:[" + e.getMessage() + "]");
} }
} }

View File

@ -44,7 +44,7 @@ public class QiniuCloudStorageStrategy extends AbstractCloudStorageStrategy {
bucketManager.createBucket(bucketName, properties.getRegion()); bucketManager.createBucket(bucketName, properties.getRegion());
} }
} catch (Exception e) { } catch (Exception e) {
throw new OssException("七牛云存储配置错误! 请检查系统配置!"); throw new OssException("七牛云存储配置错误! 请检查系统配置:[" + e.getMessage() + "]");
} }
} }
@ -57,7 +57,7 @@ public class QiniuCloudStorageStrategy extends AbstractCloudStorageStrategy {
} }
bucketManager.createBucket(bucketName, properties.getRegion()); bucketManager.createBucket(bucketName, properties.getRegion());
} catch (Exception e) { } catch (Exception e) {
throw new OssException("创建Bucket失败, 请核对七牛云配置信息"); throw new OssException("创建Bucket失败, 请核对七牛云配置信息:[" + e.getMessage() + "]");
} }
} }
@ -74,7 +74,7 @@ public class QiniuCloudStorageStrategy extends AbstractCloudStorageStrategy {
throw new RuntimeException("上传七牛出错:" + res.toString()); throw new RuntimeException("上传七牛出错:" + res.toString());
} }
} catch (Exception e) { } catch (Exception e) {
throw new OssException("上传文件失败,请核对七牛配置信息"); throw new OssException("上传文件失败,请核对七牛配置信息:[" + e.getMessage() + "]");
} }
return new UploadResult().setUrl(getEndpointLink() + "/" + path).setFilename(path); return new UploadResult().setUrl(getEndpointLink() + "/" + path).setFilename(path);
} }