@databiosphere/findable-ui 1.0.0 → 1.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -13,20 +13,22 @@ const entities_1 = require("../../../apis/azul/common/entities");
13
13
  */
14
14
  function buildExportToTerraUrl(exportToTerraUrl, requestParams, location) {
15
15
  if (!location) {
16
- console.error("Error attempting to build export to Terra link. No location given.");
17
- return "";
16
+ throw new Error("Error attempting to build export to Terra link. No location given.");
18
17
  }
19
18
  const format = requestParams.get("format"); // TODO(cc) constant
20
19
  if (!format) {
21
- console.error("Error attempting to build export to Terra link. No format found.");
22
- return "";
20
+ throw new Error("Error attempting to build export to Terra link. No format found.");
23
21
  }
24
22
  // Build up request params for export link: format if PFB and the encoded location.
25
23
  const paramTokens = [];
26
- if (format === entities_1.MANIFEST_DOWNLOAD_FORMAT.TERRA_PFB) {
24
+ if (format === entities_1.MANIFEST_DOWNLOAD_FORMAT.TERRA_PFB ||
25
+ format === entities_1.MANIFEST_DOWNLOAD_FORMAT.VERBATIM_PFB) {
27
26
  // Translate Azul PFB format param value to Terra PFB format value. That is, terra.pfb to PFB.
28
27
  paramTokens.push(`format=${constants_1.EXPORT_TO_TERRA_URL_PFB_FORMAT}`);
29
28
  }
29
+ else {
30
+ throw new Error(`Error attempting to build export to Terra link. Unsupported format: ${format}`);
31
+ }
30
32
  const encodedUrl = encodeURIComponent(location);
31
33
  paramTokens.push(`url=${encodedUrl}`);
32
34
  const urlParams = paramTokens.join("&");
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@databiosphere/findable-ui",
3
- "version": "1.0.0",
3
+ "version": "1.0.1",
4
4
  "description": "",
5
5
  "scripts": {
6
6
  "test": "jest",
@@ -15,25 +15,30 @@ export function buildExportToTerraUrl(
15
15
  location?: string
16
16
  ): string {
17
17
  if (!location) {
18
- console.error(
18
+ throw new Error(
19
19
  "Error attempting to build export to Terra link. No location given."
20
20
  );
21
- return "";
22
21
  }
23
22
 
24
23
  const format = requestParams.get("format"); // TODO(cc) constant
25
24
  if (!format) {
26
- console.error(
25
+ throw new Error(
27
26
  "Error attempting to build export to Terra link. No format found."
28
27
  );
29
- return "";
30
28
  }
31
29
 
32
30
  // Build up request params for export link: format if PFB and the encoded location.
33
31
  const paramTokens = [];
34
- if (format === MANIFEST_DOWNLOAD_FORMAT.TERRA_PFB) {
32
+ if (
33
+ format === MANIFEST_DOWNLOAD_FORMAT.TERRA_PFB ||
34
+ format === MANIFEST_DOWNLOAD_FORMAT.VERBATIM_PFB
35
+ ) {
35
36
  // Translate Azul PFB format param value to Terra PFB format value. That is, terra.pfb to PFB.
36
37
  paramTokens.push(`format=${EXPORT_TO_TERRA_URL_PFB_FORMAT}`);
38
+ } else {
39
+ throw new Error(
40
+ `Error attempting to build export to Terra link. Unsupported format: ${format}`
41
+ );
37
42
  }
38
43
 
39
44
  const encodedUrl = encodeURIComponent(location);