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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T04:39:09+00:00 2026-06-09T04:39:09+00:00

How can I avoid getting an error when passing as argument to the function

  • 0

How can I avoid getting an error when passing as argument to the function do-http-request an invalid host.
Is there any way that I can catch the error like the Java’s exception-handling mechanism ?

  • 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-09T04:39:11+00:00Added an answer on June 9, 2026 at 4:39 am

    Sure, CL has a very nice condition system. One easy option would be wrapping the call to do-http-request in ignore-errors, which returns nil (and the condition as a second value) if an error condition was signalled in the wrapped code. You could then check for nil afterwards.

    If you want something more like exception handling in Java, just use handler-case and add an appropriate error clause (I don’t have AllegroServe installed, but I suppose you get a socket-error for providing a wrong URL – just change that part if I misread):

    (handler-case
        (do-http-request …)
      (socket-error ()
        …))
    

    If you need finally-like functionality, use unwind-protect:

    (unwind-protect
         (handler-case
             (do-http-request …)
           (socket-error (condition) ; bind the signalled condition
             …)                      ; code to run when a socket-error was signalled
           (:no-error (value)        ; bind the returned value
             …))                     ; code to run when no condition was signalled
      …)                             ; cleanup code (finally)
    

    You can even get more fancy, and e.g. use handler-bind to handle the condition stack upwards by invoking a restart somewhere down the stack, without unwinding it. For example, if do-http-request provided a restart to try again with another URL, you could handle your error condition by invoking that restart with a new URL to retry. I just mention this for the sake of completeness – it would be overkill for your use case, but being able to resume (possibly expensive) computations easily can be a rather convenient feature.

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

Sidebar

Related Questions

Is there any way I can avoid using array_flip to optimize performance. I am
I am getting the error The return URL specified for request redirection is invalid
How can you easily avoid getting this error/notice in PHP? Notice: Undefined index: test
How can you easily avoid getting this error/notice: Notice: Undefined offset: 1 in /var/www/page.php
I have been getting an error message that I can't resolve. It originates from
Can I avoid the open DataReader exception (There is already an open DataReader associated
How can I avoid NullPointerExceptions ? I have tried using try-catch blocks but that
How can I avoid that a user starts the same program twice? The current
How can I avoid circular redirect using HttpClient 4.1.1. As I am getting the
I have implemented a write function for my class but iam getting error: class

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.