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 8548029
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T13:24:01+00:00 2026-06-11T13:24:01+00:00

When I try to catch an Exception in a controller method I could not

  • 0

When I try to catch an Exception in a controller method I could not catch SocketException. The controller action looks like:

def updateDeviceStartV1() {
      try {
         ...
         response.status = 200;
         response.setContentType("application/octet-stream")
         response.outputStream << responseService.encryptedResponse // byte[]
      }
      catch(Exception e) {
         log.error "Server faced unexpected exception", e
         response.status = 500;
         ...
      }

The SocketException is thrown by line “response.outputStream << responseService.encryptedResponse” because the client unexpectedly close the connection. Nevertheless, this exception is not catched and the console receives standard exception display…

Am I doing something wrong?

  • 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-06-11T13:24:03+00:00Added an answer on June 11, 2026 at 1:24 pm

    I think that if the method where the exception is raised doesn’t throw the exception explicitly (with a throws in the signature), it will be thrown as an UndeclaredThrowableException. Then the type in your catch just doesn’t match it. Try catching SocketException instead. Or if you can just catch them all using catch(all).
    Oh, take a look at this.

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

Sidebar

Related Questions

Is there some method where one could use a try statement to catch an
try { // Code } catch (Exception ex) { Logger.Log(Message, ex); throw; } In
Can you try/catch a stack overflow exception in java? It seems to be throwing
try{Integer.parse(Abhishek);} catch(NumberFormatException e){} catch(Exception e){} If for the above piece of code, if NumberFormatException
I can fix the below exception with a try-catch loop but I cannot understand
I'm trying to throw an exception (without using a try catch block) and my
I have this snipped code: try{ JAXB.xmlJavaConverter(clientCommand); } catch (Exception e){ nServerFifo.add(clientCommand); } I
Background: Suppose I have the following obviously-incorrect PHP: try{ $vtest = ''; print(array_pop($vtest)); }catch(Exception
Why can't I catch this exception? My (client) code: Eigen::MatrixXd FFs ; try {
I have this code try { //AN EXCEPTION IS GENERATED HERE!!! } catch {

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.