mirror of https://gitee.com/karson/fastadmin.git
!385 基于PHP7.1版本使用Catch多个语句
Merge pull request !385 from Henry/optimiza-exception-handlepull/390/MERGE
commit
9116b86a36
|
|
@ -110,13 +110,7 @@ trait Backend
|
||||||
}
|
}
|
||||||
$result = $this->model->allowField(true)->save($params);
|
$result = $this->model->allowField(true)->save($params);
|
||||||
Db::commit();
|
Db::commit();
|
||||||
} catch (ValidateException $e) {
|
} catch (ValidateException|PDOException|Exception $e) {
|
||||||
Db::rollback();
|
|
||||||
$this->error($e->getMessage());
|
|
||||||
} catch (PDOException $e) {
|
|
||||||
Db::rollback();
|
|
||||||
$this->error($e->getMessage());
|
|
||||||
} catch (Exception $e) {
|
|
||||||
Db::rollback();
|
Db::rollback();
|
||||||
$this->error($e->getMessage());
|
$this->error($e->getMessage());
|
||||||
}
|
}
|
||||||
|
|
@ -161,13 +155,7 @@ trait Backend
|
||||||
}
|
}
|
||||||
$result = $row->allowField(true)->save($params);
|
$result = $row->allowField(true)->save($params);
|
||||||
Db::commit();
|
Db::commit();
|
||||||
} catch (ValidateException $e) {
|
} catch (ValidateException|PDOException|Exception $e) {
|
||||||
Db::rollback();
|
|
||||||
$this->error($e->getMessage());
|
|
||||||
} catch (PDOException $e) {
|
|
||||||
Db::rollback();
|
|
||||||
$this->error($e->getMessage());
|
|
||||||
} catch (Exception $e) {
|
|
||||||
Db::rollback();
|
Db::rollback();
|
||||||
$this->error($e->getMessage());
|
$this->error($e->getMessage());
|
||||||
}
|
}
|
||||||
|
|
@ -207,10 +195,7 @@ trait Backend
|
||||||
$count += $v->delete();
|
$count += $v->delete();
|
||||||
}
|
}
|
||||||
Db::commit();
|
Db::commit();
|
||||||
} catch (PDOException $e) {
|
} catch (PDOException|Exception $e) {
|
||||||
Db::rollback();
|
|
||||||
$this->error($e->getMessage());
|
|
||||||
} catch (Exception $e) {
|
|
||||||
Db::rollback();
|
Db::rollback();
|
||||||
$this->error($e->getMessage());
|
$this->error($e->getMessage());
|
||||||
}
|
}
|
||||||
|
|
@ -248,10 +233,7 @@ trait Backend
|
||||||
$count += $v->delete(true);
|
$count += $v->delete(true);
|
||||||
}
|
}
|
||||||
Db::commit();
|
Db::commit();
|
||||||
} catch (PDOException $e) {
|
} catch (PDOException|Exception $e) {
|
||||||
Db::rollback();
|
|
||||||
$this->error($e->getMessage());
|
|
||||||
} catch (Exception $e) {
|
|
||||||
Db::rollback();
|
Db::rollback();
|
||||||
$this->error($e->getMessage());
|
$this->error($e->getMessage());
|
||||||
}
|
}
|
||||||
|
|
@ -288,10 +270,7 @@ trait Backend
|
||||||
$count += $item->restore();
|
$count += $item->restore();
|
||||||
}
|
}
|
||||||
Db::commit();
|
Db::commit();
|
||||||
} catch (PDOException $e) {
|
} catch (PDOException|Exception $e) {
|
||||||
Db::rollback();
|
|
||||||
$this->error($e->getMessage());
|
|
||||||
} catch (Exception $e) {
|
|
||||||
Db::rollback();
|
Db::rollback();
|
||||||
$this->error($e->getMessage());
|
$this->error($e->getMessage());
|
||||||
}
|
}
|
||||||
|
|
@ -327,10 +306,7 @@ trait Backend
|
||||||
$count += $item->allowField(true)->isUpdate(true)->save($values);
|
$count += $item->allowField(true)->isUpdate(true)->save($values);
|
||||||
}
|
}
|
||||||
Db::commit();
|
Db::commit();
|
||||||
} catch (PDOException $e) {
|
} catch (PDOException|Exception $e) {
|
||||||
Db::rollback();
|
|
||||||
$this->error($e->getMessage());
|
|
||||||
} catch (Exception $e) {
|
|
||||||
Db::rollback();
|
Db::rollback();
|
||||||
$this->error($e->getMessage());
|
$this->error($e->getMessage());
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue