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

  • SEARCH
  • Home
  • 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 6823299
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T21:45:59+00:00 2026-05-26T21:45:59+00:00

We have a web server which has exposed an api where the client can

  • 0

We have a web server which has exposed an api where the client can upload a file. That file is read in the server and certain processing happens and a http response with status code 200 is generated. Sometimes, however, a file with data in the wrong format is received by the server. How should this case be handled? By letting an exception occur, or by returning a 400 bad request?

EDIT –

Is throwing an exception equivalent to returning 500 status code? Should this be used in this case?

  • 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-26T21:46:00+00:00Added an answer on May 26, 2026 at 9:46 pm

    In my opinion, one shouldn’t use non-200 codes to report application-level issues to client, these codes reserved purely for HTTP-level functions.

    It is sensible to just return 200 code and place application-level error code/message/whatever in HTTP response body

    However, there is at least one protocol that uses 500 codes to communicate application-level failures: SOAP. For example, here’s head of HTTP response containing SOAP fault message:

    HTTP/1.1 500 Internal Server Error
    Content-Type: application/soap+xml; charset="utf-8"
    Content-Length: nnnn
    
    <?xml version='1.0' ?>
    <env:Envelope xmlns:env="http://www.w3.org/2003/05/soap-envelope">
      <env:Body>
        <env:Fault>
         <env:Code>
           <env:Value>env:Sender</env:Value>
           <env:Subcode>
            <env:Value>rpc:BadArguments</env:Value>
           </env:Subcode>
         </env:Code>
    

    But, anyway, you see that not just 500 HTTP error code is returned, but application-level (SOAP) data is included with elaborate information about what happened.

    Ultimately, it’s up to you to decide whether you’ll use something besides 200 for your protocol. Your client requirements will decide if lone 500 error code is sufficient for them to fully communicate error and it’s reasons. If it’s sufficient, you don’t need anything else. If it’s not, invent your protocol or, better, use existing one, like SOAP or REST.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a windows 2003 server (WEb edition) which has .net 3.5 sp1 installed
I have a web server which is protected behind http-basic-auth. I've read through the
I have a program that downloads PCM data from a Web Server, which it
I have Django project on Dreamhost server which has several views that returns Json
I have written a mini web-server which needs to serve up a few static
I currently have a single web server hosting multiple WordPress sites which use W3TC.
I have a web application, which is using a SQL Server 2005 database. My
I have a Java web-service which currently runs on a local tomcat server. I
I have a WCF service which has two methods exposed: Note: The wcf service
We've got a web server which has been running a number of separate applications

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.