Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6058537
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T08:36:36+00:00 2026-05-23T08:36:36+00:00

I create service and I need create class MyErrors (not exception) My web method

  • 0

I create service and I need create class MyErrors (not exception)

My web method returned or data or error, example response “#45#Not valid login or password.“

# – is a flag that says an error has occurred
45 – code error.

example use error class:

int returnValue = ExistLogin(login);
if (returnValue==0) {
    return Registaration(login, name, password);
} else if(returnValue==1) {
    return Errors.LOGIN_ALREADY_EXISTS.ToString();
}
else return Errors.ConvertToString(returnValue);

Errors.LOGIN_ALREADY_EXISTS – return number <-1

Errors.LOGIN_ALREADY_EXISTS – return string #-1#Error bla bla bla

how best to create a class?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-23T08:36:37+00:00Added an answer on May 23, 2026 at 8:36 am

    You can use a Java enum for this:

    public enum Errors {
        LOGIN_ALREADY_EXISTS(-1, "The username is already in use."),
        UNKNOWN(0, "Unknown");
    
        private final int errorCode;
        private final String message;
    
        private Errors(int errorCode, String message) {
            this.errorCode = errorCode;
            this.message = message;
        }
    
        public int getErrorCode() {
            return errorCode;
        }
    
        public String getMessage() {
            return message;
        }
    
        @Override
        public String toString() {
            return "#" + errorCode + "#" + message;
        }
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Anybody knows how to do this? I need to create a service that will
I need to create some windows service which will execute every N period of
I need to create a photo gallery service that is managed by users. I've
I have created an web service I need to publish this service. I need
I have several web services I need to create for them some testing mechanism
I work a lot with external Web Services, and I need to create an
We are trying to create a web-service that we plan to pass a variable
I would like create a web service in ASP.Net 2.0 that will supports JSON.
I need to create a class that gets a delegate does some calculation and
I need to call a web service to receive a JSON object which I'll

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.