Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions docs/source/changelog.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,10 @@

- Support configuration files in `.nblink`

### Bugs fixed

- Only start the web server if build is successful

## 0.6.0

### Enhancements made
Expand Down
8 changes: 4 additions & 4 deletions src/repo2wasm/buildpacks/exceptions.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
class Repo2WasmError(Exception):
class BuildPackError(Exception):
documentation_url = "https://repo2wasm.readthedocs.io/en/latest/common-errors/"
error_page = ""
long_message = ""
Expand All @@ -11,16 +11,16 @@ def __init__(self, msg="", *args, **kwargs):
super().__init__(final_message, *args, **kwargs)


class IRKernelError(Repo2WasmError):
class IRKernelError(BuildPackError):
error_page = "irkernel"
long_message = "irkernel library is NOT supported. Use xeus-r instead."


class TidyVerseError(Repo2WasmError):
class TidyVerseError(BuildPackError):
error_page = "tidyverse"
long_message = "tidyverse library is NOT supported."


class OctaveKernelError(Repo2WasmError):
class OctaveKernelError(BuildPackError):
error_page = "octave-kernel"
long_message = "octave-kernel is NOT supported. Use xeus-octave instead."
4 changes: 2 additions & 2 deletions src/repo2wasm/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -97,14 +97,14 @@ def cli():

logging.basicConfig(encoding="utf-8", level=selected_logging_level)

repo2wasm(
doit_result = repo2wasm(
args.repository,
ide=args.ide,
output_dir=args.output_dir,
forgiving=args.forgiving,
)

if not args.no_run:
if doit_result == 0 and (not args.no_run):
# Based on https://stackoverflow.com/a/60658796/1802726

class Handler(http.server.SimpleHTTPRequestHandler):
Expand Down
11 changes: 4 additions & 7 deletions src/repo2wasm/repo2wasm.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
from repo2docker import contentproviders

from .binder import get_buildpack
from .buildpacks.exceptions import Repo2WasmError

logger = logging.getLogger(__name__)

Expand Down Expand Up @@ -58,10 +57,8 @@ def repo2wasm(repository, ide="jupyterlab", output_dir="public", forgiving=False
logger.info("Output directory: %s", output_dir_absolute_path)

checkout_path = fetch_repository(repository)
try:
buildpack = get_buildpack(checkout_path, ide, output_dir, forgiving)
buildpack = get_buildpack(checkout_path, ide, output_dir, forgiving)

# doit_run will run all the necessary previous steps
buildpack.doit_run("post_build")
except Repo2WasmError as error:
logger.error(error)
# doit_run will run all the necessary previous steps
# doit_run capture the exception
return buildpack.doit_run("post_build")
Loading