CiviCRM Community Forums (archive)

*

News:

Have a question about CiviCRM?
Get it answered quickly at the new
CiviCRM Stack Exchange Q+A site

This forum was archived on 25 November 2017. Learn more.
How to get involved.
What to do if you think you've found a bug.



  • CiviCRM Community Forums (archive) »
  • Old sections (read-only, deprecated) »
  • Support »
  • Using CiviCRM »
  • Using Profiles (Moderator: Dave Greenberg) »
  • Nicer error message
Pages: [1]

Author Topic: Nicer error message  (Read 1365 times)

xavier

  • Forum Godess / God
  • I’m (like) Lobo ;)
  • *****
  • Posts: 4453
  • Karma: 161
    • Tech To The People
  • CiviCRM version: yes probably
  • CMS version: drupal
Nicer error message
April 23, 2009, 07:53:11 am
Hi,

When you try to go to a profile and don't have the access right, the error message "feels" like a technical problem:

Code: [Select]
    Sorry. A non-recoverable error has occurred.

    The requested Profile (gid=4) is disabled OR it is not configured to be used for 'Profile' listings in its Settings OR there is no Profile with that ID OR you do not have permission to access this profile. Please contact the site administrator if you need assistance.


Is there a way of making it look nicer and tune it ? eg "this area is for members only, that way to register, with love ?"

X+
-Hackathon and data journalism about the European parliament 24-26 jan. Watch out the result

adixon

  • I post frequently
  • ***
  • Posts: 314
  • Karma: 19
    • Blackfly Solutions
Re: Nicer error message
April 24, 2009, 06:51:05 am
Well, i agree it's not a very nice error message and that's a general problem.

As a specific problem - you could intercept it before it gets to CiviCRM [say in your theme, if you're using Drupal] and do something nicer there.

In terms of the general solution - i'd want to distinguish between the two cases:

a. what is essentially a useability issue [e.g. your example], in which case you'd want to use something like logintoboggan's "show a login form whenever a user doesn't have adequate permissions for a page and isn't logged in".

b. a security response [e.g. if the profile is actually not something anyone else should even know about, i.e. an administrative only profile], in which case it should instead be a standard permission denied kind of page instead of a fatal error.

In even more general terms - I'd like the code base as a whole to stop taking the approach that if something unexpected happens to throw a fatal error. A little nuance in handling unexpected input would make CiviCRM a much better experience.

Donald Lobo

  • Administrator
  • I’m (like) Lobo ;)
  • *****
  • Posts: 15963
  • Karma: 470
    • CiviCRM site
  • CiviCRM version: 4.2+
  • CMS version: Drupal 7, Joomla 2.5+
  • MySQL version: 5.5.x
  • PHP version: 5.4.x
Re: Nicer error message
April 24, 2009, 06:54:17 am

Note that you can write and register your own fatal error handler and have a nice little error page to display instead of the fatal error

The main issue for us right now is:

1. we have not been using exceptions, and hence cannot abort the current operation, which means we need to exit rather than use the page layout of the underlying CMS

in v3 once we switch to using exceptions for handling errors, i suspect we can do a much better job trapping errors/warnings

lobo

p.s> however in this case, the error is a bit more serious and not just unexpected input

A new CiviCRM Q&A resource needs YOUR help to get started. Visit our StackExchange proposed site, sign up and vote on 5 questions

xavier

  • Forum Godess / God
  • I’m (like) Lobo ;)
  • *****
  • Posts: 4453
  • Karma: 161
    • Tech To The People
  • CiviCRM version: yes probably
  • CMS version: drupal
Re: Nicer error message
April 24, 2009, 09:46:49 am
Hi,

Is there an example of a custom error handler ?

X+

P.S. and I'd like to distinguish between anonymous (not logged in) users and users that don't have the proper rights, to be able to display a different error msg.

 
-Hackathon and data journalism about the European parliament 24-26 jan. Watch out the result

Pages: [1]
  • CiviCRM Community Forums (archive) »
  • Old sections (read-only, deprecated) »
  • Support »
  • Using CiviCRM »
  • Using Profiles (Moderator: Dave Greenberg) »
  • Nicer error message

This forum was archived on 2017-11-26.