Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Clarify error message when adapter has no features #3089

Merged
merged 2 commits into from
Jul 13, 2022

Conversation

garrettjstevens
Copy link
Collaborator

This uses some similar checks to #3084 to show a different error message when a reference sequence track that uses a ChromSizesAdapter or FromConfigRegionsAdapter is opened (mentioned here).

Before it said Error: Data adapter not found, now it says Error: Adapter does not support retrieving features.

@garrettjstevens garrettjstevens added the enhancement New feature or request label Jul 12, 2022
@garrettjstevens garrettjstevens self-assigned this Jul 12, 2022
@codecov
Copy link

codecov bot commented Jul 12, 2022

Codecov Report

Merging #3089 (8ec5c18) into main (8adb316) will decrease coverage by 0.03%.
The diff coverage is 75.00%.

@@            Coverage Diff             @@
##             main    #3089      +/-   ##
==========================================
- Coverage   61.41%   61.38%   -0.04%     
==========================================
  Files         595      595              
  Lines       27216    27218       +2     
  Branches     6563     6564       +1     
==========================================
- Hits        16715    16708       -7     
- Misses      10204    10213       +9     
  Partials      297      297              
Impacted Files Coverage Δ
...gableElementTypes/renderers/FeatureRendererType.ts 71.15% <75.00%> (-0.85%) ⬇️
packages/core/rpc/coreRpcMethods.ts 80.45% <75.00%> (ø)
...svg/src/SvgFeatureRenderer/components/Segments.tsx 85.71% <0.00%> (-7.15%) ⬇️
...src/SvgFeatureRenderer/components/FeatureLabel.tsx 77.41% <0.00%> (-6.46%) ⬇️
...gins/svg/src/SvgFeatureRenderer/components/util.ts 91.83% <0.00%> (-4.09%) ⬇️
...rative-view/src/ServerSideRenderedBlockContent.tsx 64.00% <0.00%> (-4.00%) ⬇️
...FeatureRenderer/components/ProcessedTranscript.tsx 87.32% <0.00%> (-1.41%) ⬇️
packages/core/util/layouts/GranularRectLayout.ts 86.86% <0.00%> (-0.43%) ⬇️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 8adb316...8ec5c18. Read the comment docs.

@cmdcolin
Copy link
Collaborator

possible change that avoids trying to return empty object from CoreEstimateRegionStats, and instead throws similar to CoreGetFeatures

diff --git a/packages/core/rpc/coreRpcMethods.ts b/packages/core/rpc/coreRpcMethods.ts
index 88b76e488..ef38f9a67 100644
--- a/packages/core/rpc/coreRpcMethods.ts
+++ b/packages/core/rpc/coreRpcMethods.ts
@@ -250,10 +250,10 @@ export class CoreEstimateRegionStats extends RpcMethodType {
       adapterConfig,
     )

-    if (isFeatureAdapter(dataAdapter)) {
-      return dataAdapter.estimateRegionsStats(regions, deserializedArgs)
+    if (!isFeatureAdapter(dataAdapter)) {
+      throw new Error('Adapter does not support retrieving features')
     }
-    return {}
+    return dataAdapter.estimateRegionsStats(regions, deserializedArgs)
   }
 }

Co-authored-by: Colin Diesh <colin.diesh@gmail.com>
@garrettjstevens
Copy link
Collaborator Author

Yeah, that works, I just pushed that change.

@cmdcolin cmdcolin merged commit a63caa4 into main Jul 13, 2022
@cmdcolin cmdcolin deleted the refseq_track_no_features branch July 13, 2022 18:37
@cmdcolin
Copy link
Collaborator

👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants