lxd/response.go
func SmartError(err error) Response {
	switch errors.Cause(err) {
	case nil:
		return EmptySyncResponse
	case os.ErrNotExist, sql.ErrNoRows, db.ErrNoSuchObject:
		return NotFound(nil)
	case os.ErrPermission:
		return Forbidden(nil)
	case db.ErrAlreadyDefined, sqlite3.ErrConstraintUnique:
		return Conflict(nil)
	case dqlite.ErrNoAvailableLeader:
		return Unavailable(err)
	default:
		return InternalError(err)
	}
}
func SmartError(err error) Response {
	switch errors.Cause(err) {
	case nil:
		return EmptySyncResponse
	case os.ErrNotExist, sql.ErrNoRows, db.ErrNoSuchObject:
		return NotFound(nil)
	case os.ErrPermission:
		return Forbidden(nil)
	case db.ErrAlreadyDefined, sqlite3.ErrConstraintUnique:
		return Conflict(nil)
	case dqlite.ErrNoAvailableLeader:
		return Unavailable(err)
	default:
		return InternalError(err)
	}
}
func SmartError ( err error ) Response { switch errors . Cause ( err ) { case nil : return EmptySyncResponse case os . ErrNotExist , sql . ErrNoRows , db . ErrNoSuchObject : return NotFound ( nil ) case os . ErrPermission : return Forbidden ( nil ) case db . ErrAlreadyDefined , sqlite3 . ErrConstraintUnique : return Conflict ( nil ) case dqlite . ErrNoAvailableLeader : return Unavailable ( err ) default : return InternalError ( err ) } }
/*
 * SmartError returns the right error message based on err.
 */
/ * SmartError returns the right error message based on err .