Skip to content

RUMM-2797 SR RequestFactory allow to throw exceptions#1217

Merged
mariusc83 merged 1 commit into
feature/sdkv2from
mconstantin/rumm-2797/sr-request-factory-throw-exceptions
Jan 6, 2023
Merged

RUMM-2797 SR RequestFactory allow to throw exceptions#1217
mariusc83 merged 1 commit into
feature/sdkv2from
mconstantin/rumm-2797/sr-request-factory-throw-exceptions

Conversation

@mariusc83

Copy link
Copy Markdown
Member

What does this PR do?

A brief description of the change being made with this pull request.

Motivation

What inspired you to submit this pull request?

Additional Notes

Anything else we should know when reviewing?

Review checklist (to be filled by reviewers)

  • Feature or bugfix MUST have appropriate tests (unit, integration, e2e)
  • Make sure you discussed the feature or bugfix with the maintaining team in an Issue
  • Make sure each commit and the PR mention the Issue number (cf the CONTRIBUTING doc)

@mariusc83 mariusc83 self-assigned this Jan 5, 2023
@mariusc83
mariusc83 force-pushed the mconstantin/rumm-2797/sr-request-factory-throw-exceptions branch 3 times, most recently from 3046306 to c410c64 Compare January 5, 2023 13:21
@mariusc83
mariusc83 marked this pull request as ready for review January 5, 2023 13:22
@mariusc83
mariusc83 requested a review from a team as a code owner January 5, 2023 13:22
@codecov-commenter

codecov-commenter commented Jan 5, 2023

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 82.64%. Comparing base (0b06acb) to head (06e0a88).

Additional details and impacted files
@@                Coverage Diff                @@
##           feature/sdkv2    #1217      +/-   ##
=================================================
- Coverage          82.72%   82.64%   -0.09%     
=================================================
  Files                353      354       +1     
  Lines              12589    12572      -17     
  Branches            2086     2085       -1     
=================================================
- Hits               10414    10389      -25     
- Misses              1535     1542       +7     
- Partials             640      641       +1     
Files with missing lines Coverage Δ
...essionreplay/internal/domain/RequestBodyFactory.kt 97.62% <100.00%> (-0.38%) ⬇️
...lay/internal/domain/SessionReplayRequestFactory.kt 96.23% <100.00%> (-0.96%) ⬇️
...nternal/exception/InvalidPayloadFormatException.kt 100.00% <100.00%> (ø)

... and 18 files with indirect coverage changes

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@0xnm 0xnm left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I left some comments, but overall ltgm.

@Suppress("UnsafeThirdPartyFunctionCall")
body.writeTo(buffer)
@Suppress("UnsafeThirdPartyFunctionCall")
return buffer.readByteArray()

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this readByteArray method is strange - it says that it can throw IOException, but the actual implementation actually can also throw Error:

    try {
      return readByteArray(size);
    } catch (EOFException e) {
      throw new AssertionError(e);
    }

Do you think we should catch it? Because the outer code only handles exceptions, but not errors. Normally errors are not recoverable though, so maybe we don't need to.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yeah...that's the thing...I would leave errors not caught ...it will be another thread anyway not the main thread.


package com.datadog.android.sessionreplay.internal.exception

internal class InvalidPayloadFormatException(message: String) : Exception(message)

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's make it extend RuntimeException, so that it is not checked one.

Suggested change
internal class InvalidPayloadFormatException(message: String) : Exception(message)
internal class InvalidPayloadFormatException(message: String) : RuntimeException(message)

@mariusc83
mariusc83 force-pushed the mconstantin/rumm-2797/sr-request-factory-throw-exceptions branch from c410c64 to 06e0a88 Compare January 6, 2023 08:47
@mariusc83
mariusc83 merged commit 98f2529 into feature/sdkv2 Jan 6, 2023
@mariusc83
mariusc83 deleted the mconstantin/rumm-2797/sr-request-factory-throw-exceptions branch January 6, 2023 09:24
@xgouchet xgouchet added this to the 1.17.0 milestone Dec 13, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants