protected function throwHalcyonSaveException(Exception $ex)
    {
        if ($ex instanceof \October\Rain\Halcyon\Exception\MissingFileNameException) {
            throw new ValidationException([
                'fileName' => Lang::get('cms::lang.cms_object.file_name_required')
            ]);
        }
        elseif ($ex instanceof \October\Rain\Halcyon\Exception\InvalidExtensionException) {
            throw new ValidationException(['fileName' =>
                Lang::get('cms::lang.cms_object.invalid_file_extension', [
                    'allowed' => implode(', ', $ex->getAllowedExtensions()),
                    'invalid' => $ex->getInvalidExtension()
                ])
            ]);
        }
        elseif ($ex instanceof \October\Rain\Halcyon\Exception\InvalidFileNameException) {
            throw new ValidationException([
               'fileName' => Lang::get('cms::lang.cms_object.invalid_file', ['name'=>$ex->getInvalidFileName()])
            ]);
        }
        elseif ($ex instanceof \October\Rain\Halcyon\Exception\FileExistsException) {
            throw new ApplicationException(
                Lang::get('cms::lang.cms_object.file_already_exists', ['name' => $ex->getInvalidPath()])
            );
        }
        elseif ($ex instanceof \October\Rain\Halcyon\Exception\CreateDirectoryException) {
            throw new ApplicationException(
                Lang::get('cms::lang.cms_object.error_creating_directory', ['name' => $ex->getInvalidPath()])
            );
        }
        elseif ($ex instanceof \October\Rain\Halcyon\Exception\CreateFileException) {
            throw new ApplicationException(
                Lang::get('cms::lang.cms_object.error_saving', ['name' => $ex->getInvalidPath()])
            );
        }
        else {
            throw $ex;
        }
    }
protected function throwHalcyonSaveException(Exception $ex)
    {
        if ($ex instanceof \October\Rain\Halcyon\Exception\MissingFileNameException) {
            throw new ValidationException([
                'fileName' => Lang::get('cms::lang.cms_object.file_name_required')
            ]);
        }
        elseif ($ex instanceof \October\Rain\Halcyon\Exception\InvalidExtensionException) {
            throw new ValidationException(['fileName' =>
                Lang::get('cms::lang.cms_object.invalid_file_extension', [
                    'allowed' => implode(', ', $ex->getAllowedExtensions()),
                    'invalid' => $ex->getInvalidExtension()
                ])
            ]);
        }
        elseif ($ex instanceof \October\Rain\Halcyon\Exception\InvalidFileNameException) {
            throw new ValidationException([
               'fileName' => Lang::get('cms::lang.cms_object.invalid_file', ['name'=>$ex->getInvalidFileName()])
            ]);
        }
        elseif ($ex instanceof \October\Rain\Halcyon\Exception\FileExistsException) {
            throw new ApplicationException(
                Lang::get('cms::lang.cms_object.file_already_exists', ['name' => $ex->getInvalidPath()])
            );
        }
        elseif ($ex instanceof \October\Rain\Halcyon\Exception\CreateDirectoryException) {
            throw new ApplicationException(
                Lang::get('cms::lang.cms_object.error_creating_directory', ['name' => $ex->getInvalidPath()])
            );
        }
        elseif ($ex instanceof \October\Rain\Halcyon\Exception\CreateFileException) {
            throw new ApplicationException(
                Lang::get('cms::lang.cms_object.error_saving', ['name' => $ex->getInvalidPath()])
            );
        }
        else {
            throw $ex;
        }
    }
protected function throwHalcyonSaveException ( Exception $ ex ) { if ( $ ex instanceof \ October \ Rain \ Halcyon \ Exception \ MissingFileNameException ) { throw new ValidationException ( [ 'fileName' => Lang :: get ( 'cms::lang.cms_object.file_name_required' ) ] ) ; } elseif ( $ ex instanceof \ October \ Rain \ Halcyon \ Exception \ InvalidExtensionException ) { throw new ValidationException ( [ 'fileName' => Lang :: get ( 'cms::lang.cms_object.invalid_file_extension' , [ 'allowed' => implode ( ', ' , $ ex -> getAllowedExtensions ( ) ) , 'invalid' => $ ex -> getInvalidExtension ( ) ] ) ] ) ; } elseif ( $ ex instanceof \ October \ Rain \ Halcyon \ Exception \ InvalidFileNameException ) { throw new ValidationException ( [ 'fileName' => Lang :: get ( 'cms::lang.cms_object.invalid_file' , [ 'name' => $ ex -> getInvalidFileName ( ) ] ) ] ) ; } elseif ( $ ex instanceof \ October \ Rain \ Halcyon \ Exception \ FileExistsException ) { throw new ApplicationException ( Lang :: get ( 'cms::lang.cms_object.file_already_exists' , [ 'name' => $ ex -> getInvalidPath ( ) ] ) ) ; } elseif ( $ ex instanceof \ October \ Rain \ Halcyon \ Exception \ CreateDirectoryException ) { throw new ApplicationException ( Lang :: get ( 'cms::lang.cms_object.error_creating_directory' , [ 'name' => $ ex -> getInvalidPath ( ) ] ) ) ; } elseif ( $ ex instanceof \ October \ Rain \ Halcyon \ Exception \ CreateFileException ) { throw new ApplicationException ( Lang :: get ( 'cms::lang.cms_object.error_saving' , [ 'name' => $ ex -> getInvalidPath ( ) ] ) ) ; } else { throw $ ex ; } }
Converts an exception type thrown by Halcyon to a native CMS exception.
@param Exception $ex
Converts an exception type thrown by Halcyon to a native CMS exception .