Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 3 of 3
  1. #1
    Regular Coder martin_narg's Avatar
    Join Date
    Jul 2002
    Location
    Chamonix, France
    Posts
    600
    Thanks
    1
    Thanked 3 Times in 3 Posts

    Creating clean RSS errors

    Hey all

    Currently writing a PHP app, part of which generates RSS feeds.

    I'm wondering whats the best way to output error messages to a dynamically created RSS page.

    For example if a user isn't logged in to my app and tries to access a feed url, I'd like to output a handle-able 'You don't have permission to access this' message.

    I'm wondering if anyone knows how RSS readers generally handle errors (HTTP error codes would definitely be one) but is there a generic, widely used way of putting error messages into the XML document itself to be cleanly handled? Is the best way just to create an item node with the error details within it?

    Cheers for your responses.

    m_n
    Last edited by martin_narg; 10-21-2010 at 05:36 PM.
    "Cos it's strange isn't it. You stand in the middle of a library and go 'Aaaaaaaaaaaaaaaaggggggghhhhhhh!'
    and everybody just stares at you. But you do the same in an aeroplane, and everybody joins in."
    -Tommy Cooper

  • #2
    Senior Coder
    Join Date
    Jul 2009
    Location
    South Yorkshire, England
    Posts
    2,318
    Thanks
    6
    Thanked 304 Times in 303 Posts
    Just send a 204, (no content), or 404 response. Whichever you prefer. No point in shunting output to the client just to tell them they can't view the feed, and if you use the 204, it won't alter their cached version of the feed if the current reason is simply because they're not logged in or suchlike.

  • Users who have thanked MattF for this post:

    martin_narg (10-22-2010)

  • #3
    Regular Coder martin_narg's Avatar
    Join Date
    Jul 2002
    Location
    Chamonix, France
    Posts
    600
    Thanks
    1
    Thanked 3 Times in 3 Posts
    That's cool thanks, I think I'll just do that.

    Cheers for the shout on the caching, not something I'd thought of.

    m_n
    "Cos it's strange isn't it. You stand in the middle of a library and go 'Aaaaaaaaaaaaaaaaggggggghhhhhhh!'
    and everybody just stares at you. But you do the same in an aeroplane, and everybody joins in."
    -Tommy Cooper


  •  

    Tags for this Thread

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •