Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
bugzilla
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
etersoft
bugzilla
Commits
cc5259d7
Commit
cc5259d7
authored
Sep 23, 2002
by
gerv%gerv.net
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Bug 170064 - Change error API again to allow vars to be passed in the call.…
Bug 170064 - Change error API again to allow vars to be passed in the call. Patch by gerv; r=bbaetz.
parent
91906eca
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
24 additions
and
12 deletions
+24
-12
CGI.pl
CGI.pl
+18
-6
post_bug.cgi
post_bug.cgi
+2
-2
process_bug.cgi
process_bug.cgi
+4
-4
No files found.
CGI.pl
View file @
cc5259d7
...
...
@@ -223,7 +223,7 @@ sub CheckFormField (\%$;\@) {
$vars
->
{
'field'
}
=
$fieldname
;
}
ThrowCodeError
(
"illegal_field"
,
"abort"
);
ThrowCodeError
(
"illegal_field"
,
undef
,
"abort"
);
}
}
...
...
@@ -827,6 +827,10 @@ sub PutFooter {
#
# If you are doing incremental output, set $vars->{'header_done'} once you've
# done the header.
#
# You can call Throw*Error with extra template variables in one pass by using
# the $extra_vars hash reference parameter:
# ThrowUserError("some_tag", { bug_id => $bug_id, size => 127 });
###############################################################################
# DisplayError is deprecated. Use ThrowCodeError, ThrowUserError or
...
...
@@ -842,13 +846,18 @@ sub DisplayError {
}
# For "this shouldn't happen"-type places in the code.
# $vars->{'variables'} is a reference to a hash of useful debugging info.
# The contents of $extra_vars get printed out in the template - useful for
# debugging info.
sub
ThrowCodeError
{
(
$vars
->
{
'error'
},
my
$
unlock_tables
,
$vars
->
{
'variables'
}
)
=
(
@_
);
(
$vars
->
{
'error'
},
my
$
extra_vars
,
my
$unlock_tables
)
=
(
@_
);
SendSQL
(
"UNLOCK TABLES"
)
if
$unlock_tables
;
# We may one day log something to file here.
# Copy the extra_vars into the vars hash
@::vars
{
keys
%
$extra_vars
}
=
values
%
$extra_vars
;
# We may one day log something to file here also.
$vars
->
{
'variables'
}
=
$extra_vars
;
print
"Content-type: text/html\n\n"
if
!
$vars
->
{
'header_done'
};
$template
->
process
(
"global/code-error.html.tmpl"
,
$vars
)
...
...
@@ -859,10 +868,13 @@ sub ThrowCodeError {
# For errors made by the user.
sub
ThrowUserError
{
(
$vars
->
{
'error'
},
my
$unlock_tables
)
=
(
@_
);
(
$vars
->
{
'error'
},
my
$
extra_vars
,
my
$
unlock_tables
)
=
(
@_
);
SendSQL
(
"UNLOCK TABLES"
)
if
$unlock_tables
;
# Copy the extra_vars into the vars hash
@::vars
{
keys
%
$extra_vars
}
=
values
%
$extra_vars
;
print
"Content-type: text/html\n\n"
if
!
$vars
->
{
'header_done'
};
$template
->
process
(
"global/user-error.html.tmpl"
,
$vars
)
||
ThrowTemplateError
(
$template
->
error
());
...
...
post_bug.cgi
View file @
cc5259d7
...
...
@@ -262,14 +262,14 @@ foreach my $b (grep(/^bit-\d*$/, keys %::FORM)) {
if
(
$::FORM
{
$b
})
{
my
$v
=
substr
(
$b
,
4
);
$v
=~
/^(\d+)$/
||
ThrowCodeError
(
"group_id_invalid"
,
"abort"
);
||
ThrowCodeError
(
"group_id_invalid"
,
undef
,
"abort"
);
if
(
!
GroupIsActive
(
$v
))
{
# Prevent the user from adding the bug to an inactive group.
# Should only happen if there is a bug in Bugzilla or the user
# hacked the "enter bug" form since otherwise the UI
# for adding the bug to the group won't appear on that form.
$vars
->
{
'bit'
}
=
$v
;
ThrowCodeError
(
"inactive_group"
,
"abort"
);
ThrowCodeError
(
"inactive_group"
,
undef
,
"abort"
);
}
SendSQL
(
"SELECT user_id FROM user_group_map
WHERE user_id = $::userid
...
...
process_bug.cgi
View file @
cc5259d7
...
...
@@ -1067,7 +1067,7 @@ foreach my $id (@idlist) {
$vars
->
{
'oldvalue'
}
=
$oldvalues
[
$i
];
$vars
->
{
'newvalue'
}
=
$::FORM
{
$col
};
$vars
->
{
'field'
}
=
$col
;
ThrowUserError
(
"illegal_change"
,
"abort"
);
ThrowUserError
(
"illegal_change"
,
undef
,
"abort"
);
}
}
$i
++
;
...
...
@@ -1082,7 +1082,7 @@ foreach my $id (@idlist) {
if
(
$value
eq
FetchOneColumn
())
{
SendSQL
(
"UNLOCK TABLES"
);
$vars
->
{
'bug_id'
}
=
$id
;
ThrowUserError
(
"milestone_required"
,
"abort"
);
ThrowUserError
(
"milestone_required"
,
undef
,
"abort"
);
}
}
if
(
defined
$::FORM
{
'delta_ts'
}
&&
$::FORM
{
'delta_ts'
}
ne
$delta_ts
)
{
...
...
@@ -1117,7 +1117,7 @@ foreach my $id (@idlist) {
next
if
$i
eq
""
;
if
(
$id
eq
$i
)
{
ThrowUserError
(
"dependency_loop_single"
,
"abort"
);
ThrowUserError
(
"dependency_loop_single"
,
undef
,
"abort"
);
}
if
(
!
exists
$seen
{
$i
})
{
push
(
@
{
$deptree
{
$target
}},
$i
);
...
...
@@ -1161,7 +1161,7 @@ foreach my $id (@idlist) {
}
$vars
->
{
'both'
}
=
$both
;
ThrowUserError
(
"dependency_loop_multi"
,
"abort"
);
ThrowUserError
(
"dependency_loop_multi"
,
undef
,
"abort"
);
}
}
my
$tmp
=
$me
;
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment