# Copyright (c) 1999-2005 bivio Software, Inc. All rights reserved. # # Visit http://www.bivio.biz for more info. # # This library is free software; you can redistribute it and/or modify # it under the terms of the GNU Lesser General Public License as # published by the Free Software Foundation; either version 2.1 of the # License, or (at your option) any later version. # # This library is distributed in the hope that it will be useful, but # WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU # Lesser General Public License for more details. # # You should have received a copy of the GNU Lesser General Public # License along with this library; If not, you may get a copy from: # http://www.opensource.org/licenses/lgpl-license.html # # $Id: DieCode.pm,v 2.4 2009/05/28 16:34:40 moeller Exp $ package Bivio::DieCode; use strict; use base 'Bivio::Type::Enum'; our($VERSION) = sprintf('%d.%02d', q$Revision: 2.4 $ =~ /\d+/g); __PACKAGE__->compile([ UNKNOWN => [ 0, undef, 'unexpected error', ], NOT_FOUND => [ 1, undef, 'entity was not found', ], ALREADY_EXISTS => [ 2, undef, 'attempt to create an entity which already exists', ], FORBIDDEN => [ 3, undef, 'operation is not allowed on entity', ], CATCH_WITHIN_DIE => [ 4, undef, 'internal program error (4)', ], INVALID_DIE_CODE => [ 5, undef, 'internal program error (5)', ], DIE => [ 6, 'internal program error (6)', ], DIE_WITHIN_HANDLE_DIE => [ 7, undef, 'internal program error (7)', ], MISSING_COOKIES => [ 8, undef, 'browser did not return all necessary cookies', ], VERSION_MISMATCH => [ 9, undef, 'user request using invalid or old form, query, or uri', ], CORRUPT_QUERY => [ 10, undef, 'user request contains invalid query value', ], SERVER_REDIRECT_TASK => [ 11, undef, 'direct dispatcher to switch to new task', ], CORRUPT_FORM => [ 12, undef, 'user request contains invalid form', ], CLIENT_REDIRECT_TASK => [ 13, undef, 'direct user agent to new task', ], TOO_MANY => [ 14, undef, 'the request returned too much data or too many records', ], NO_RESOURCES => [ 15, undef, 'insufficient resources to satisfy the request', ], IO_ERROR => [ 16, undef, 'file system error', ], CLIENT_ERROR => [ 17, undef, 'error reading or writing to the client', ], UPDATE_COLLISION => [ 18, undef, 'two or more people are trying to update your records simultaneously', ], DB_ERROR => [ 19, undef, 'unexpected error while communicating with database', ], MAIL_LOOP => [ 20, undef, 'avoid a mail loop', ], UNEXPECTED_EOF => [ 21, undef, 'unexpected end of file', ], CONFIG_ERROR => [ 22, undef, 'missing or incorrect configuration. Please check your bconf file.', ], DB_CONSTRAINT => [ 23, undef, 'unexpected database constraint violation', ], MODEL_NOT_FOUND => [ 24, undef, 'model was not found', ], INVALID_OP => [ 25, undef, 'invalid operation', ], INPUT_TOO_LARGE => [ 26, undef, 'input too large', ], ]); sub throw_die { # (self, hash_ref) : undef # (self, scalar) : undef # Dies in caller with this die code. my($self, $attrs) = @_; Bivio::Die->throw($self, ref($attrs) eq 'HASH' ? $attrs : {message => $attrs}, caller); } 1;