diff --git a/src/errors.h b/src/errors.h
index 1b656ba1b8faf43bb389d374077365b738bff3ef..7524e7f0b770b3652ed0378a0a46ef0c99681d2e 100644
--- a/src/errors.h
+++ b/src/errors.h
@@ -2,7 +2,7 @@
 || This file is part of Pike. For copyright information see COPYRIGHT.
 || Pike is distributed under GPL, LGPL and MPL. See the file COPYING
 || for more information.
-|| $Id: errors.h,v 1.22 2002/10/11 01:39:31 nilsson Exp $
+|| $Id: errors.h,v 1.23 2003/07/21 23:41:34 mast Exp $
 */
 
 #ifdef ERR_DECLARE
@@ -124,6 +124,8 @@ DECLARE_ERROR(cpp, ERR_INHERIT(generic), EMPTY)
 
 DECLARE_ERROR(compilation, ERR_INHERIT(generic), EMPTY)
 
+DECLARE_ERROR(master_load, ERR_INHERIT (generic), EMPTY)
+
 #undef DECLARE_ERROR
 #undef ERR_INHERIT
 #undef ERR_VAR
diff --git a/src/main.c b/src/main.c
index f027788f3572693e2a3500b15f272c2bc6f6e424..6c752fef5a8f4cfd0ed20ba513aa56876ff14ff6 100644
--- a/src/main.c
+++ b/src/main.c
@@ -2,11 +2,11 @@
 || This file is part of Pike. For copyright information see COPYRIGHT.
 || Pike is distributed under GPL, LGPL and MPL. See the file COPYING
 || for more information.
-|| $Id: main.c,v 1.177 2003/06/30 17:06:09 mast Exp $
+|| $Id: main.c,v 1.178 2003/07/21 23:41:34 mast Exp $
 */
 
 #include "global.h"
-RCSID("$Id: main.c,v 1.177 2003/06/30 17:06:09 mast Exp $");
+RCSID("$Id: main.c,v 1.178 2003/07/21 23:41:34 mast Exp $");
 #include "fdlib.h"
 #include "backend.h"
 #include "module.h"
@@ -722,7 +722,23 @@ int dbm_main(int argc, char **argv)
     {
       num=throw_value.u.integer;
     }else{
-      if (get_master()) call_handle_error();
+      if (throw_value.type == T_OBJECT &&
+	  throw_value.u.object->prog == master_load_error_program &&
+	  !get_master()) {
+	/* Report this specific error in a nice way. Since there's no
+	 * master it'd be reported with a raw error dump otherwise. */
+	struct generic_error_struct *err;
+	*(Pike_sp++) = throw_value;
+	dmalloc_touch_svalue(Pike_sp-1);
+	throw_value.type=T_INT;
+	err = (struct generic_error_struct *)
+	  get_storage (Pike_sp[-1].u.object, generic_error_program);
+	push_string (err->desc);
+	f_werror (1);
+	pop_stack();
+      }
+      else
+	call_handle_error();
       num=10;
     }
   }else{
diff --git a/src/object.c b/src/object.c
index 57bb594b37ecebba96e78ed18bddd8b6002efaee..77171e0d74ed7819912c35f0f7649b9d6b245fc7 100644
--- a/src/object.c
+++ b/src/object.c
@@ -2,11 +2,11 @@
 || This file is part of Pike. For copyright information see COPYRIGHT.
 || Pike is distributed under GPL, LGPL and MPL. See the file COPYING
 || for more information.
-|| $Id: object.c,v 1.240 2003/07/21 16:23:58 grubba Exp $
+|| $Id: object.c,v 1.241 2003/07/21 23:41:34 mast Exp $
 */
 
 #include "global.h"
-RCSID("$Id: object.c,v 1.240 2003/07/21 16:23:58 grubba Exp $");
+RCSID("$Id: object.c,v 1.241 2003/07/21 23:41:34 mast Exp $");
 #include "object.h"
 #include "dynamic_buffer.h"
 #include "interpret.h"
@@ -606,7 +606,8 @@ PMOD_EXPORT struct object *get_master(void)
       sp--;
       dmalloc_touch_svalue(sp);
     }else{
-      Pike_error("Couldn't load master program. (%s)\n",master_file);
+      throw_error_object (low_clone (master_load_error_program), 0, 0, 0,
+			  "Couldn't load master program from %s.\n", master_file);
     }
   }