MCPcopy Index your code
hub / github.com/docker/docker-agent / TestFormatError_OverflowKinds

Function TestFormatError_OverflowKinds

pkg/modelerrors/modelerrors_test.go:372–399  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

370}
371
372func TestFormatError_OverflowKinds(t *testing.T) {
373 t.Parallel()
374
375 t.Run("wire overflow surfaces request-too-large message", func(t *testing.T) {
376 t.Parallel()
377 err := &StatusError{StatusCode: 413, Err: errors.New(`Payload Too Large`)}
378 msg := FormatError(err)
379 assert.Contains(t, msg, "too large")
380 assert.NotContains(t, msg, "/compact")
381 assert.NotContains(t, msg, "context window")
382 })
383
384 t.Run("media overflow surfaces image-too-large message", func(t *testing.T) {
385 t.Parallel()
386 err := errors.New(`image exceeds 5 MB maximum: 5316852 bytes > 5242880 bytes`)
387 msg := FormatError(err)
388 assert.Contains(t, msg, "image or file")
389 assert.NotContains(t, msg, "/compact")
390 })
391
392 t.Run("token overflow keeps the /compact hint", func(t *testing.T) {
393 t.Parallel()
394 err := errors.New(`prompt is too long: 200000 tokens > 128000 maximum`)
395 msg := FormatError(err)
396 assert.Contains(t, msg, "context window")
397 assert.Contains(t, msg, "/compact")
398 })
399}
400
401func TestContextOverflowError(t *testing.T) {
402 t.Parallel()

Callers

nothing calls this directly

Calls 3

FormatErrorFunction · 0.85
RunMethod · 0.65
NewMethod · 0.45

Tested by

no test coverage detected