1
0
forked from 0ad/0ad

Catch exceptions by reference (by convention), based on patch from Markus, refs #1852

This was SVN commit r13421.
This commit is contained in:
historic_bruno 2013-05-22 22:27:53 +00:00
parent 72a8b88b7d
commit a8a968d32c
13 changed files with 28 additions and 28 deletions

View File

@ -1,4 +1,4 @@
/* Copyright (C) 2009 Wildfire Games.
/* Copyright (C) 2013 Wildfire Games.
* This file is part of 0 A.D.
*
* 0 A.D. is free software: you can redistribute it and/or modify
@ -120,7 +120,7 @@ JSBool JSI_GUISize::toString(JSContext* cx, uintN argc, jsval* vp)
SIDE(bottom);
#undef SIDE
}
catch (PSERROR_Scripting_ConversionFailed)
catch (PSERROR_Scripting_ConversionFailed&)
{
JS_SET_RVAL(cx, vp, STRING_TO_JSVAL(JS_NewStringCopyZ(cx, "<Error converting value to numbers>")));
return JS_TRUE;

View File

@ -1,4 +1,4 @@
/* Copyright (C) 2010 Wildfire Games.
/* Copyright (C) 2013 Wildfire Games.
* This file is part of 0 A.D.
*
* 0 A.D. is free software: you can redistribute it and/or modify
@ -193,7 +193,7 @@ JSBool JSI_IGUIObject::getProperty(JSContext* cx, JSObject* obj, jsid id, jsval*
P(percent, bottom, rbottom);
#undef P
}
catch (PSERROR_Scripting_ConversionFailed)
catch (PSERROR_Scripting_ConversionFailed&)
{
debug_warn(L"Error creating size object!");
break;
@ -670,7 +670,7 @@ JSBool JSI_IGUIObject::getComputedSize(JSContext* cx, uintN argc, jsval* vp)
g_ScriptingHost.SetObjectProperty_Double(obj, "top", size.top);
g_ScriptingHost.SetObjectProperty_Double(obj, "bottom", size.bottom);
}
catch (PSERROR_Scripting_ConversionFailed)
catch (PSERROR_Scripting_ConversionFailed&)
{
debug_warn(L"Error creating size object!");
return JS_FALSE;

View File

@ -1,4 +1,4 @@
/* Copyright (c) 2010 Wildfire Games
/* Copyright (c) 2013 Wildfire Games
*
* Permission is hereby granted, free of charge, to any person obtaining
* a copy of this software and associated documentation files (the
@ -99,7 +99,7 @@ STMT(\
{\
ptr = new type();\
}\
catch(std::bad_alloc)\
catch(std::bad_alloc&)\
{\
ptr = 0;\
}

View File

@ -1,4 +1,4 @@
/* Copyright (c) 2010 Wildfire Games
/* Copyright (c) 2013 Wildfire Games
*
* Permission is hereby granted, free of charge, to any person obtaining
* a copy of this software and associated documentation files (the
@ -447,7 +447,7 @@ static Status call_init_and_reload(Handle h, H_Type type, HDATA* hd, const PIVFS
if(err == INFO::OK)
warn_if_invalid(hd);
}
catch(std::bad_alloc)
catch(std::bad_alloc&)
{
err = ERR::NO_MEM;
}

View File

@ -1,4 +1,4 @@
/* Copyright (C) 2012 Wildfire Games.
/* Copyright (C) 2013 Wildfire Games.
* This file is part of 0 A.D.
*
* 0 A.D. is free software: you can redistribute it and/or modify
@ -258,7 +258,7 @@ static int ProgressiveLoad()
break;
}
}
catch (PSERROR_Game_World_MapLoadFailed e)
catch (PSERROR_Game_World_MapLoadFailed& e)
{
// Map loading failed

View File

@ -1,4 +1,4 @@
/* Copyright (C) 2009 Wildfire Games.
/* Copyright (C) 2013 Wildfire Games.
* This file is part of 0 A.D.
*
* 0 A.D. is free software: you can redistribute it and/or modify
@ -179,7 +179,7 @@ JSBool JSI_Vector3D::construct(JSContext* cx, uintN argc, jsval* vp)
JS_SET_RVAL(cx, vp, OBJECT_TO_JSVAL(vector));
return JS_TRUE;
}
catch (PSERROR_Scripting_ConversionFailed)
catch (PSERROR_Scripting_ConversionFailed&)
{
// Invalid input (i.e. can't be coerced into doubles) - fail
JS_ReportError(cx, "Invalid parameters to Vector3D constructor");

View File

@ -1,4 +1,4 @@
/* Copyright (C) 2009 Wildfire Games.
/* Copyright (C) 2013 Wildfire Games.
* This file is part of 0 A.D.
*
* 0 A.D. is free software: you can redistribute it and/or modify
@ -58,11 +58,11 @@ And you can use it as an exception:
try {
foo();
} catch (PSERROR_ModuleName_FrobnificationFailed e) {
} catch (PSERROR_ModuleName_FrobnificationFailed& e) {
// catches that particular error type
} catch (PSERROR_ModuleName e) {
} catch (PSERROR_ModuleName& e) {
// catches anything in the hierarchy
} catch (PSERROR e) {
} catch (PSERROR& e) {
std::cout << e.what();
}

View File

@ -1027,7 +1027,7 @@ void InitGraphics(const CmdLineArgs& args, int flags)
InitPs(setup_gui, L"page_pregame.xml", data.get());
}
}
catch (PSERROR_Game_World_MapLoadFailed e)
catch (PSERROR_Game_World_MapLoadFailed& e)
{
// Map Loading failed

View File

@ -1,4 +1,4 @@
/* Copyright (C) 2011 Wildfire Games.
/* Copyright (C) 2013 Wildfire Games.
* This file is part of 0 A.D.
*
* 0 A.D. is free software: you can redistribute it and/or modify

View File

@ -1,4 +1,4 @@
/* Copyright (C) 2010 Wildfire Games.
/* Copyright (C) 2013 Wildfire Games.
* This file is part of 0 A.D.
*
* 0 A.D. is free software: you can redistribute it and/or modify
@ -77,7 +77,7 @@ JSBool JSI_Console::setProperty(JSContext* UNUSED(cx), JSObject* UNUSED(obj), js
g_Console->SetVisible(ToPrimitive<bool> (*vp));
return JS_TRUE;
}
catch (PSERROR_Scripting_ConversionFailed)
catch (PSERROR_Scripting_ConversionFailed&)
{
return JS_TRUE;
}
@ -110,7 +110,7 @@ JSBool JSI_Console::writeConsole(JSContext* cx, uintN argc, jsval* vp)
CStrW arg = g_ScriptingHost.ValueToUCString(JS_ARGV(cx, vp)[i]);
output += arg;
}
catch (PSERROR_Scripting_ConversionFailed)
catch (PSERROR_Scripting_ConversionFailed&)
{
}
}

View File

@ -1,4 +1,4 @@
/* Copyright (C) 2010 Wildfire Games.
/* Copyright (C) 2013 Wildfire Games.
* This file is part of 0 A.D.
*
* 0 A.D. is free software: you can redistribute it and/or modify
@ -255,7 +255,7 @@ template<> bool ToPrimitive<CStrW>( JSContext* UNUSED(cx), jsval v, CStrW& Stora
{
Storage = g_ScriptingHost.ValueToUCString( v );
}
catch( PSERROR_Scripting_ConversionFailed )
catch( PSERROR_Scripting_ConversionFailed& )
{
return( false );
}

View File

@ -1,4 +1,4 @@
/* Copyright (C) 2010 Wildfire Games.
/* Copyright (C) 2013 Wildfire Games.
* This file is part of 0 A.D.
*
* 0 A.D. is free software: you can redistribute it and/or modify
@ -346,7 +346,7 @@ JSBool SetPaused(JSContext* cx, uintN argc, jsval* vp)
g_SoundManager->Pause(g_Game->m_Paused);
#endif
}
catch (PSERROR_Scripting_ConversionFailed)
catch (PSERROR_Scripting_ConversionFailed&)
{
JS_ReportError(cx, "Invalid parameter to SetPaused");
}

View File

@ -1,4 +1,4 @@
/* Copyright (C) 2012 Wildfire Games.
/* Copyright (C) 2013 Wildfire Games.
* This file is part of 0 A.D.
*
* 0 A.D. is free software: you can redistribute it and/or modify
@ -103,7 +103,7 @@ QUERYHANDLER(GenerateMap)
msg->status = 0;
}
catch (PSERROR_Game_World_MapLoadFailed e)
catch (PSERROR_Game_World_MapLoadFailed&)
{
// Cancel loading
LDR_Cancel();