]>
git.ipfire.org Git - thirdparty/squid.git/blob - src/sbuf/SBufExceptions.cc
2 * Copyright (C) 1996-2016 The Squid Software Foundation and contributors
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.
10 #include "OutOfBoundsException.h"
12 #include "SBufExceptions.h"
14 OutOfBoundsException::OutOfBoundsException(const SBuf
&throwingBuf
,
16 const char *aFileName
, int aLineNo
)
17 : TextException(NULL
, aFileName
, aLineNo
),
18 theThrowingBuf(throwingBuf
),
21 SBuf
explanatoryText("OutOfBoundsException");
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 // we can safely alias c_str as both are local to the object
29 // and will not further manipulated.
30 message
= xstrndup(explanatoryText
.c_str(),explanatoryText
.length());
33 OutOfBoundsException::~OutOfBoundsException() throw()
36 InvalidParamException::InvalidParamException(const char *aFilename
, int aLineNo
)
37 : TextException("Invalid parameter", aFilename
, aLineNo
)
40 SBufTooBigException::SBufTooBigException(const char *aFilename
, int aLineNo
)
41 : TextException("Trying to create an oversize SBuf", aFilename
, aLineNo
)