Change exit calls to throwing an exception

This way the error won't be fatal in a unit test
This commit is contained in:
Bart Visscher 2013-07-21 22:29:50 +02:00
parent 37a731bcad
commit df8ad46dae
3 changed files with 4 additions and 6 deletions

View File

@ -839,9 +839,8 @@ class OC_App{
OC_Hook::emit('update', 'success', 'Updated '.$info['name'].' app');
}
catch (Exception $e) {
echo 'Failed to upgrade "'.$app.'". Exception="'.$e->getMessage().'"';
OC_Hook::emit('update', 'failure', 'Failed to update '.$info['name'].' app: '.$e->getMessage());
die;
throw new RuntimeException('Failed to upgrade "'.$app.'". Exception="'.$e->getMessage().'"');
}
OC_Appconfig::setValue($app, 'installed_version', OC_App::getAppVersion($app));
}

View File

@ -62,7 +62,7 @@ class OC_Files {
$zip = new ZipArchive();
$filename = OC_Helper::tmpFile('.zip');
if ($zip->open($filename, ZIPARCHIVE::CREATE | ZIPARCHIVE::OVERWRITE)!==true) {
exit("cannot open <$filename>\n");
throw new Exception("cannot open '$filename'\n");
}
foreach ($files as $file) {
$file = $dir . '/' . $file;
@ -93,7 +93,7 @@ class OC_Files {
$zip = new ZipArchive();
$filename = OC_Helper::tmpFile('.zip');
if ($zip->open($filename, ZIPARCHIVE::CREATE | ZIPARCHIVE::OVERWRITE)!==true) {
exit("cannot open <$filename>\n");
throw new Exception("cannot open '$filename'\n");
}
$file = $dir . '/' . $files;
self::zipAddDir($file, $zip);

View File

@ -176,8 +176,7 @@ class OC_Helper {
}elseif( file_exists( OC::$SERVERROOT."/core/img/$image" )) {
return OC::$WEBROOT."/core/img/$image";
}else{
echo('image not found: image:'.$image.' webroot:'.OC::$WEBROOT.' serverroot:'.OC::$SERVERROOT);
die();
throw new RuntimeException('image not found: image:'.$image.' webroot:'.OC::$WEBROOT.' serverroot:'.OC::$SERVERROOT);
}
}