<? if ( ! defined('BASEPATH')) exit('No direct script access allowed');

class Cm_Exception extends Exception {

	public function __construct($type, $code, $msg) {

        if($type=='json') {
            header("Content-Type: application/json");

            $arr = array();
            $arr = array('code' => $code, 'msg' => $msg);

            echo json_encode($arr);
            exit;
        } else if($type=='html') {
            header("Content-Type: text/html; charset=UTF-8");
            echo $code.'|||||'.$msg;
            exit;

        }

	}

}
