Skip to content
Browse files

use appropiate exception types in Expporter misuses

  • Loading branch information...
1 parent 5eef2c2 commit 8e59a00406b10b3e1eb0540093a8a1aeb4db4a2e @NotFound NotFound committed
Showing with 9 additions and 8 deletions.
  1. +9 −8 src/pmc/exporter.pmc
View
17 src/pmc/exporter.pmc
@@ -166,7 +166,7 @@ Throws an exception if a non-NameSpace PMC is passed.
METHOD source(PMC *src :optional, int got_src :opt_flag) {
if (got_src) {
if (src->vtable->base_type != enum_class_NameSpace)
- Parrot_ex_throw_from_c_args(INTERP, NULL, 0,
+ Parrot_ex_throw_from_c_args(INTERP, NULL, EXCEPTION_INVALID_OPERATION,
"source must be a NameSpace PMC");
SET_ATTR_ns_src(INTERP, SELF, src);
@@ -196,8 +196,8 @@ Throws an exception if a non-NameSpace PMC is passed.
if (got_dest) {
if (dest->vtable->base_type != enum_class_NameSpace)
- Parrot_ex_throw_from_c_args(INTERP, NULL, 0,
- "destination must be a NameSpace PMC");
+ Parrot_ex_throw_from_c_args(INTERP, NULL, EXCEPTION_INVALID_OPERATION,
+ "destination must be a NameSpace PMC");
SET_ATTR_ns_dest(INTERP, SELF, dest);
}
@@ -267,8 +267,8 @@ Throws an exception if an unknown PMC type is passed.
temp_globals = glb;
}
else {
- Parrot_ex_throw_from_c_args(INTERP, NULL, 0,
- "Invalid type %d in globals()", glb->vtable->base_type);
+ Parrot_ex_throw_from_c_args(INTERP, NULL, EXCEPTION_INVALID_OPERATION,
+ "Invalid type %d in globals()", glb->vtable->base_type);
}
SET_ATTR_globals(INTERP, SELF, temp_globals);
@@ -323,12 +323,13 @@ Throws an exception upon error.
GET_ATTR_ns_src(INTERP, SELF, ns_src);
if (PMC_IS_NULL(ns_src))
- Parrot_ex_throw_from_c_args(INTERP, NULL, 0, "source namespace not set");
+ Parrot_ex_throw_from_c_args(INTERP, NULL, EXCEPTION_INVALID_OPERATION,
+ "source namespace not set");
GET_ATTR_ns_dest(INTERP, SELF, ns_dest);
if (PMC_IS_NULL(ns_dest))
- Parrot_ex_throw_from_c_args(INTERP, NULL, 0,
- "destination namespace not set");
+ Parrot_ex_throw_from_c_args(INTERP, NULL, EXCEPTION_INVALID_OPERATION,
+ "destination namespace not set");
GET_ATTR_globals(INTERP, SELF, ns_globals);

0 comments on commit 8e59a00

Please sign in to comment.
Something went wrong with that request. Please try again.