errors.go 729 B

12345678910111213141516171819
  1. package lz4
  2. import "errors"
  3. var (
  4. // ErrInvalidSourceShortBuffer is returned by UncompressBlock or CompressBLock when a compressed
  5. // block is corrupted or the destination buffer is not large enough for the uncompressed data.
  6. ErrInvalidSourceShortBuffer = errors.New("lz4: invalid source or destination buffer too short")
  7. // ErrInvalid is returned when reading an invalid LZ4 archive.
  8. ErrInvalid = errors.New("lz4: bad magic number")
  9. // ErrBlockDependency is returned when attempting to decompress an archive created with block dependency.
  10. ErrBlockDependency = errors.New("lz4: block dependency not supported")
  11. )
  12. func recoverBlock(e *error) {
  13. if recover() != nil && *e == nil {
  14. *e = ErrInvalidSourceShortBuffer
  15. }
  16. }