<?php
/**
 * DropsizeMVCf - extension of the SlimFramework and others tools
 *
 * @author      Isaac Trenado <
[email protected]>
 * @copyright   2013 Isaac Trenado
 * @link        http://dropsize.codigolimpio.com
 * @license     http://dropsize.codigolimpio.com/license.txt
 * @version     3.0.1
 * @package     DropsizeMVCf
 *
 * DropsizeMVCf - Web publishing software
 * Copyright 2015 by the contributors
 * 
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation; either version 2 of the License, or
 * (at your option) any later version.
 * 
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 * 
 * You should have received a copy of the GNU General Public License
 * along with this program; if not, write to the Free Software
 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
 * 
 * This program incorporates work covered by the following copyright and
 * permission notices:
 * 
 * DropsizeMVCf is (c) 2013, 2015 
 * Isaac Trenado - 
[email protected] -
 * http://www.codigolimpio.com
 * 
 * Wherever third party code has been used, credit has been given in the code's comments.
 *
 * DropsizeMVCf is released under the GPL
 * 
 */
/**
 * Slimframework template
 * 
 * @package com.dropsizemvcf.templates.error
 * @author  Isaac Trenado
 * @since   1.0.0
 *
 *
 */
defined('_DSEXEC') or die;
$app = Slim::getInstance();
$req = $app->request();
$res = $app->response();
$err = $e->getTrace();
if ($req->isAjax()) {
    // Armamos la respuesta en json
    echo json_encode(
            array("success" => 0, "code" => $e->getCode()
                , "estatus" => $res->status()
                , "mensaje" => $e->getMessage()
                , "trace" => $err[0]
            )
    );
} else {
    echo json_encode(array($e->getMessage(), $err[0]));
}