1//  Copyright (c) 2014 Couchbase, Inc.
2//  Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file
3//  except in compliance with the License. You may obtain a copy of the License at
4//    http://www.apache.org/licenses/LICENSE-2.0
5//  Unless required by applicable law or agreed to in writing, software distributed under the
6//  License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
7//  either express or implied. See the License for the specific language governing permissions
8//  and limitations under the License.
9
10package errors
11
12import ()
13
14// Parse errors - errors that are created in the parse package
15func NewParseSyntaxError(e error, msg string) Error {
16	switch e := e.(type) {
17	case Error: // if given error is already an Error, just return it:
18		return e
19	default:
20		return &err{level: EXCEPTION, ICode: 3000, IKey: "parse.syntax_error", ICause: e,
21			InternalMsg: msg, InternalCaller: CallerN(1)}
22	}
23}
24