Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[ISSUE #4521] A poor naming. #4523

Closed
wants to merge 9 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,9 @@

package org.apache.eventmesh.admin.dto;

import static org.apache.eventmesh.admin.enums.Errors.SUCCESS;
import static org.apache.eventmesh.admin.enums.Status.SUCCESS;

import org.apache.eventmesh.admin.enums.Errors;
import org.apache.eventmesh.admin.enums.Status;
import org.apache.eventmesh.admin.exception.BaseException;

import org.springframework.http.HttpStatus;
Expand Down Expand Up @@ -131,7 +131,7 @@ public Message(BaseException e) {
* Only recommended for returning successful results,
* the stack trace cannot be displayed when returning unsuccessful results.
*/
public Message(Errors errors) {
public Message(Status errors) {
this.name = errors.name();
this.type = errors.getType().name();
this.desc = errors.getDesc(); // no stack trace
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
*/

@Getter
public enum Errors {
public enum Status {

SUCCESS(HttpStatus.OK, Types.SUCCESS, "Operation success."),

Expand All @@ -58,7 +58,7 @@ public enum Errors {
// error message
private final String desc;

Errors(HttpStatus code, Types type, String desc) {
Status(HttpStatus code, Types type, String desc) {
this.code = code;
this.type = type;
this.desc = desc;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@

import static org.apache.eventmesh.admin.common.ConfigConst.COLON;

import org.apache.eventmesh.admin.enums.Errors;
import org.apache.eventmesh.admin.enums.Status;
import org.apache.eventmesh.admin.utils.ExceptionUtils;

import lombok.Getter;
Expand All @@ -33,7 +33,7 @@ public class BaseException extends RuntimeException {

private static final long serialVersionUID = 3509261993355721168L;

private Errors errors;
private Status errors;

public BaseException(String message) {
super(message);
Expand All @@ -42,12 +42,12 @@ public BaseException(String message) {
/**
* Customized error reporting using enums and exceptions
*/
public BaseException(Errors errors, Throwable cause) {
public BaseException(Status errors, Throwable cause) {
super(ExceptionUtils.trimDesc(errors.getDesc()) + COLON + cause.getMessage(), cause);
this.errors = errors;
}

public BaseException(Errors errors) {
public BaseException(Status errors) {
super(errors.getDesc());
this.errors = errors;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@

package org.apache.eventmesh.admin.exception;

import org.apache.eventmesh.admin.enums.Errors;
import org.apache.eventmesh.admin.enums.Status;

/**
* EventMeshAdmin Application side exception
Expand All @@ -34,7 +34,7 @@ public EventMeshAdminException(String message) {
/**
* Customized error reporting using enums and exceptions
*/
public EventMeshAdminException(Errors errors, Throwable cause) {
public EventMeshAdminException(Status errors, Throwable cause) {
super(errors, cause);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
import lombok.extern.slf4j.Slf4j;

/**
* This class, in conjunction with {@linkplain org.apache.eventmesh.admin.enums.Errors Errors} and {@link BaseException},
* This class, in conjunction with {@linkplain org.apache.eventmesh.admin.enums.Status Status} and {@link BaseException},
* collectively implements customized error reporting.
*/

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@

package org.apache.eventmesh.admin.exception;

import org.apache.eventmesh.admin.enums.Errors;
import org.apache.eventmesh.admin.enums.Status;

/**
* Meta side exception with EventMeshAdmin Application
Expand All @@ -34,11 +34,11 @@ public MetaException(String message) {
/**
* Customized error reporting using enums and exceptions
*/
public MetaException(Errors errors, Throwable cause) {
public MetaException(Status errors, Throwable cause) {
super(errors, cause);
}

public MetaException(Errors errors) {
public MetaException(Status errors) {
super(errors);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,11 @@

package org.apache.eventmesh.admin.service.impl;

import static org.apache.eventmesh.admin.enums.Errors.NACOS_EMPTY_RESP_ERR;
import static org.apache.eventmesh.admin.enums.Errors.NACOS_GET_CONFIGS_ERR;
import static org.apache.eventmesh.admin.enums.Errors.NACOS_LOGIN_EMPTY_RESP_ERR;
import static org.apache.eventmesh.admin.enums.Errors.NACOS_LOGIN_ERR;
import static org.apache.eventmesh.admin.enums.Errors.NACOS_SDK_CONFIG_ERR;
import static org.apache.eventmesh.admin.enums.Status.NACOS_EMPTY_RESP_ERR;
import static org.apache.eventmesh.admin.enums.Status.NACOS_GET_CONFIGS_ERR;
import static org.apache.eventmesh.admin.enums.Status.NACOS_LOGIN_EMPTY_RESP_ERR;
import static org.apache.eventmesh.admin.enums.Status.NACOS_LOGIN_ERR;
import static org.apache.eventmesh.admin.enums.Status.NACOS_SDK_CONFIG_ERR;

import org.apache.eventmesh.admin.common.ConfigConst;
import org.apache.eventmesh.admin.common.NacosConst;
Expand Down
Loading