]> git.ipfire.org Git - thirdparty/squid.git/blob - src/sbuf/Exceptions.cc
Docs: Copyright updates for 2018 (#114)
[thirdparty/squid.git] / src / sbuf / Exceptions.cc
1 /*
2 * Copyright (C) 1996-2018 The Squid Software Foundation and contributors
3 *
4 * Squid software is distributed under GPLv2+ license and includes
5 * contributions from numerous individuals and organizations.
6 * Please see the COPYING and CONTRIBUTORS files for details.
7 */
8
9 #include "squid.h"
10 #include "sbuf/Exceptions.h"
11 #include "sbuf/OutOfBoundsException.h"
12 #include "sbuf/SBuf.h"
13
14 OutOfBoundsException::OutOfBoundsException(const SBuf &throwingBuf,
15 SBuf::size_type &pos,
16 const char *aFileName, int aLineNo)
17 : TextException(NULL, aFileName, aLineNo),
18 theThrowingBuf(throwingBuf),
19 accessedPosition(pos)
20 {
21 SBuf explanatoryText("OutOfBoundsException");
22 if (aLineNo != -1)
23 explanatoryText.appendf(" at line %d", aLineNo);
24 if (aFileName != NULL)
25 explanatoryText.appendf(" in file %s", aFileName);
26 explanatoryText.appendf(" while accessing position %d in a SBuf long %d",
27 pos, throwingBuf.length());
28 message = xstrdup(explanatoryText.c_str());
29 }
30
31 OutOfBoundsException::~OutOfBoundsException() throw()
32 { }
33
34 InvalidParamException::InvalidParamException(const char *aFilename, int aLineNo)
35 : TextException("Invalid parameter", aFilename, aLineNo)
36 { }
37
38 SBufTooBigException::SBufTooBigException(const char *aFilename, int aLineNo)
39 : TextException("Trying to create an oversize SBuf", aFilename, aLineNo)
40 { }
41